problem using docker run is that each time we run docker run, a new ocntainer is created. therefore, it is impossible to use any existing profile.
also, running docker run again and again leaves a ton of unused containers on the server.
I’me trying to run the task using docker exec instead :
Starting to process folder: /music/Music_dump/03-2023/01-03
Sending Pushover notification: Starting to process folder: /music/Music_dump/03-2023/01-03
Executing the command: docker exec f8ccfc3f1ad4 /opt/songkong/songkong.sh -m /music/Music_dump/03-2023/01-03
but this leads to the same behavior as the previous time. The process is simply not starting. I think something needs to be changed inside songkong code in order to allow to start a task using docker xec command.
so here is how I fixed this (somehow). I’ve use the following function to actually run a docker, that gets deleted once the process ends. this to avoid having multiple stopped docker containers piling on my server :
def run_songkong(relative_path):
# Use docker run with --rm to start SongKong in a new container for each folder and delete the container afterwards
container_name = "songkong_{}".format(relative_path.replace('-', '_')) # Naming the container for clarity
cmd = "docker run --rm --name {} -v /mnt/cache/appdata/songkong:/songkong -v /mnt/user/MURRAY/Music:/music {} -m {}".format(container_name, DOCKER_IMAGE_NAME, os.path.join(DOCKER_FOLDER, relative_path))
log_action("Executing the command: {}".format(cmd))
process = subprocess.Popen(cmd.split(), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
while True:
line = process.stdout.readline().decode("utf-8").strip()
if "Reports:" in line:
log_action("SongKong finished processing for folder: {}".format(relative_path))
break
output, error = process.communicate()
now this has one major issue. as the docker container is pulled each time, I cannot keep any preferences. It means I have to use the default profile to fix my tracks, as it is setup when you inisially install songkong.
If you have a good idea on how to pass the settings through this command paul, I’m taking your advices !
here is how it looks like in the terminal :
So, it works. it starts a container, runs he task, sends pushover notifications, and stops the container / remove it, then goes to the next folder, and so on. I simply need to figure out with you how to make the profile settings persistant. For the fix songs task, it is not super important. But once i’ll move to the duplicates mover / finder, ti will become really important.
of course, as it uses the “default” songkong folders (Eg: it creates the reports in the Report folder and. so on), I might want to simply remove all the profiles, and only keep one. That might do the trick, as songkong won’t have any other profile to use ! I’ll test that later on.