Before ITunes and online music stores/streaming-options came arround, you had to build up a digital music collection if you wanted to load an MP3 player with it. I always prefered this option. This meant that I could manage my own collection, and that I wasn’t fixed to a service that would eat up all of my data and that I could listen to what I wanted. For example, in most US music services you can’t find the band Die Toten Hosen. They’re a great German band, but they haven’t hit the US market. Also, having your own collection it’s a lot easier to move the collection to other devices without having the direct integration (such as my car stereo).
The downside to managing your own music collection is that you’re subject to managing the collection yourself. That means that a large collection can get unwieldy very quickly. Thankfully there are a few tools to help with that. I found the JThink tools (SongKong and Jaikoz) to be very helpful with keeping an organized music collection.
What is it?
This project is intended to automatically standardize files into a human-friendly collection without user intervention.
What technologies are used?
-
Bash
-
SongKong (Jthink.net)- For file formatting, metadata correction, and metadata improvements (From an online source)
-
FFMpeg (for media conversion)
-
Docker
-
Docker Registry
How did I solve it?
To solve this issue I did the following:
-
Created the Dockerfile and outlined the general steps used.
-
Identified the software dependencies.
-
Opened up X forwarding to test out SongKong (It’s mainly an X application, that has the possibility of a command line tool)
-
Ensured that Songkong could operate from within the Docker container
-
Moved over the Ogg2MP3 and Flac2Mp3 scripts. (Which can be found at Github.com/monksy)
-
Created a docker registry so that I can keep the docker image local. (Songkong is a licensed and for pay product)
-
Setup the CI pipeline with Jenkins
-
Create a script to run on the box managing the music collection. This uses the Docker Registry to pull down this process and run the organization utility
-
Setup the Crontab scripts to run the container
**Some of the challenges that I had while doing all of this included: **
-
The difference between the run command and entrypoint. The entrypoint command within docker runs the command when the container is invoked. The RUN command may run only when the container is being built.
-
The Jenkins Docker plugins are a little difficult to use and setup. I tried using the Docker-build-step plugin, however, it tended to include very little documentation, was very unhelpful about invalid input and was difficult to build and publish. Fortunately the Cloudbees Docker Build and Publish plugin was just what I was looking for.
-
Debugging the Docker Registry was a pain. For the most part you’ll have to depend on the standard output coming out. If not that, do a docker exec -ti
/bin/bash and look for the log files.
1. This really needs to be improved to output what is broken and why
2. Bad logins to the docker registry from the client go from Version 2 of the API to Version 1 if something goes wrong on the Version 2 request. (I.e. a bad certificate file). This is frustrating.
- If you have a LetsEncrypt certificate to use on the Docker registry, it’s not very well documented that you should be using the Fullchain certificate file. Without it, you’ll have security issues.
1. Another note on this, it should be a lot easier to create users on the registry rather than to generate HTAccess files.
2. If you are generate a user access file, you have to use bcrypt as the encryption option. Otherwise, the docker registry won’t accept your credentials.
-
The storage option that I used for storing the collection was a network mount point. Not having the proper permissions on the server side for the child folders caused a wild goose chase. That lead to studying up on the options of the mount.cifs tool. (For example file_mode, dir_mode, noperms, and forceuid options).
-
Reproducing the application’s environment was a little difficult as that it wasn’t clear about where it’s private files were located.
-
The id3 tagging command originally used no longer exists. I had to upgrade to the Id3v2 software and reformat the command usage.