Skip to content

silkyclouds/Autokong

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AutoKong: Automate SongKong Music Management Tasks

AutoKong GIF

Introduction

AutoKong is a script designed to automate the tasks of the SongKong music management application. SongKong is a powerful tool for managing and organizing your music library. However, processing large folders can be cumbersome and may lead to memory overloads and other issues. AutoKong helps by automating SongKong tasks, ensuring large folders are split into manageable sizes before processing, and providing flexibility in task execution.

A special thanks to Paul Taylor, the developer of SongKong, for his unwavering support to all users of his project. You can download SongKong from that link: https://jthink.net/songkong/.

Features

  • Automates SongKong Tasks: Automates the following SongKong tasks:
    • Matching songs to MusicBrainz & Discogs
    • Matching songs to Bandcamp
    • Deleting duplicate songs
    • Renaming and moving albums / matched songs
  • Handles Large Folders: Splits large folders into subfolders of up to 500GB before processing to avoid memory overload and unexpected issues when running SongKong on terabytes of music.
  • Tracks Processed Folders: Maintains a log of processed folders to avoid reprocessing. Users have the option to reprocess already processed folders if desired.
  • Notifications: Optional notifications via Pushover and Discord.

Prerequisites

  • SongKong via Docker: Ensure you have SongKong installed and running via Docker.
  • Profile Configuration: Configure SongKong for each task and save the profiles in the Prefs folder. Run SongKong at least once on a single album to generate these profiles. The choices applied by users are personal, so it's essential to know exactly what settings you want to apply before running AutoKong.

Configuration

Docker and Folder Paths

  • DOCKER_IMAGE_NAME: Docker image name for SongKong.
  • HOST_SONGKONG_VOLUME: Path to the SongKong volume on the host.
  • HOST_MUSIC_VOLUME: Path to the music volume on the host.
  • CONTAINER_SONGKONG_VOLUME: Path to the SongKong volume in the container.
  • CONTAINER_MUSIC_VOLUME: Path to the music volume in the container.

Notifications

  • Pushover: Configure pushover_user_key and pushover_api_token for Pushover notifications (optional).
  • Discord: Configure DISCORD_WEBHOOK_URL for Discord notifications (optional).

Task Profiles

PROPERTIES: Paths to the SongKong profile files for each task.

# Configuration
DOCKER_IMAGE_NAME = "songkong/songkong"
HOST_SONGKONG_VOLUME = "/mnt/cache/appdata/songkong"
HOST_MUSIC_VOLUME = "/path/to/your/music"
CONTAINER_SONGKONG_VOLUME = "/songkong"
CONTAINER_MUSIC_VOLUME = "/music"
pushover_user_key = ""  # OPTIONAL: Enter your Pushover user key
pushover_api_token = ""  # OPTIONAL: Enter your Pushover API token
DISCORD_WEBHOOK_URL = ""  # OPTIONAL: Enter your Discord webhook URL
NOTIFICATION_INTERVAL_MINUTES = 60
FULL_REPORTING = True  # Change to True for full reporting
SEND_INTERMEDIATE_NOTIFICATIONS = False  # Set to False to disable intermediate notifications
RUN_FOLDERS_SPLIT_BASH_SCRIPT = False  # Change to False if you do not want to run the Bash script
SERVER_IP = "192.168.3.2"  # Your usual SongKong server IP

# Global variable to store past processing times and processed folders
past_processing_times = []
processed_folders = []

# Properties for SongKong tasks
PROPERTIES = {
    "musicbrainz": "songkong_fixsongs.properties",
    "bandcamp": "songkong_bandcamp.properties",
    "deleteduplicates": "songkong_deleteduplicates.properties",
    "rename": "songkong_renamefiles.properties"
}

Usage

Run AutoKong:

python3 Autokong.py

Provide Input:

  • Folder to analyze (default: /path/to/your/music/)
  • Split folders into 500GB subfolders (default: no)
  • Task to execute (default: Full set of tasks)
  • Process folders that have already been processed (default: no)
  • Reset the list of processed folders (default: no)

Explanation of Script Functionality

Initial Setup

AutoKong starts by initializing the list of processed folders from processed_folders.txt. If the file does not exist, it starts with an empty list.

Running Tasks

AutoKong executes the selected SongKong task on each subfolder within the specified folder. Tasks include matching to MusicBrainz, matching to Bandcamp, deleting duplicates, and renaming/moving files. The script ensures that the SongKong database is deleted before each task to avoid corruption from repeated runs.

Task Details

  • Match to MusicBrainz: Matches songs to the MusicBrainz database using the specified profile.
  • Match to Bandcamp: Matches songs to the Bandcamp database using the specified profile.
  • Delete Duplicates: Deletes duplicate songs using the specified profile.
  • Rename/Move Albums: Renames and moves albums using the specified profile.

Users have the flexibility to run any of these tasks individually or in sequence as specified.

Notifications

Notifications are sent via Pushover and Discord (if configured). If notification keys are not provided, the script will run without sending notifications, and logs must be checked manually. Logs are stored in the Logs folder of the SongKong volume.

Progress Tracking

AutoKong logs the progress of each task and maintains a summary. The summary includes the number of folders processed, remaining folders, and overall progress. It also logs the time taken for each task and calculates the estimated time for the next folder.

Cleaning Up

After each task, AutoKong ensures that the Docker container is stopped and logs are moved to a backup folder.

Why Delete the Database?

Deleting the SongKong database before each task prevents corruption caused by repeated runs of AutoKong. SongKong reads information directly from the files, so AutoKong does not depend on the SongKong database. I obviously recommend you to run a dedicated container of songkong pointed to a dedicated docker volume in order to keep another instance of your database intact!

And in order to help you out, here are my properties files ❤️

I try to be a nice guy, so let me share my own properties files with you (they are put alongside the other files in the repo, under the /Prefs folder). It won't make it unnecessary for you to pre-run a SongKong task as previously explained, but I rigorously tested my settings, and I believe these settings are the safest in order to run AutoKong without messing things up. So how does this work? First, run each task using SongKong's web UI; it will create the right files in the /Prefs folder. If you are happy with your settings, there is no need to use the files I attached to this GitHub repo, but if you want to make things work fast and efficiently, you can give these properties files a try.

the only rule: Be careful!

SongKong is a powerful tool; it can help you manage your music library the way you want it to be organized, but it also could screw things up if you do not know what you are doing. So, for GOD's sake, read the configuration files, understand what you are doing, and experiment on a set of files you backed up before jumping blindly into the ocean.

About

Automate Songkong music management

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published