After completing my Lidarr setup using the 'binhex lidarr' docker I noticed that most music files listed these days are in the FLAC format.
Being old school and still using a iPod Video 5th Gen I wanted my collections to be in MP3 format so wanted a way to automatically convert these.
I searched through the Lidarr GitHub and the unraid forums here and couldn't find a solution but did come across a Lidarr docker container which had the functionality via a shell script.
https://hub.docker.com/r/thecaptain989/lidarr
As I'd already setup Lidarr I wondered if it was possible to edit my docker container and apply the scripts from the above container.
To my surprise the short answer is YES
If this is something you want to do here's a short tutorial on how I did it...
First, you ned to get access to your Lidarr Docker container. To do this I simply followed spaceinvaderone's YouTube tutorial - How to easily bash into a running docker container (NOTE: I had to use 'bash docker-shell' to run the command)
Now I had access to the Lidarr container I needed to check to see of the two dependices 'ffmpeg' and 'awk' needed to run the 'flac2mp3.sh' script were already installed. This I did by just trying to run them and to my surprise both were already in the 'binhex-lidarr' container.
ffmpeg
awk
The next stage was to get to the correct place to download and run the scripts from...
cd /usr/local/bin/
Download the scripts from the GitHub repo..
curl -O https://raw.githubusercontent.com/TheCaptain989/lidarr-flac2mp3/7fda34528327e907cf583385c68260512ffb4ba3/flac2mp3.sh
curl -O https://raw.githubusercontent.com/TheCaptain989/lidarr-flac2mp3/7fda34528327e907cf583385c68260512ffb4ba3/flac2mp3-debug.sh
Make them executable...
chmod +x flac2mp3.sh
chmod +x flac2mp3-debug.sh
Now, if you're happy to have 320Kbps MP3 conversions you can ignore this next section.
The default output is 320kbps but if you want to change this because you have a large collection and file size is an important consideration (compare mp3 file sizes here https://audio-rescue.com/file-size/) you can do this by creating a 'wrapper' script which will send arguments to the 'flac2mp3.sh' script
First, you'll need to create a new wrapper script so copy the debug script.
Copy the 'flac2mp3-debug.sh' file
cp flac2mp3-debug.sh flac2mp3-options.sh
Edit it in nano
nano flac2mp3-options.sh
You can remove the 'debug logging' argument -d and add -b with your desired bitrate at the end like below and then save the file.
#!/bin/bash
. /usr/local/bin/flac2mp3.sh -b 190k
You should be done with the terminal now
Login to your unread server and go to your Lidarr Docker WebUI and go to 'Settings > Connect'.
Create a 'Custom Script' trigger by selecting the + and then 'Custom Script'.
Name it something like 'FLAC to MP3' and select 'On Release Import' and 'On Upgrade' as the only notification triggers (these have been tested).
In the path find the script you just setup either the default script '/usr/local/bin/flac2mp3.sh' or your wrapper script.
Click test to check and if all is good click save and you're done.
Now when you download any Flac files once they have been downloaded and moved to your Lidarr directory they will be converted into mp3's
You can see this happening if you open the directories as they are being processed.
Huge thanks go to thecaptain989 who had done most of the work and @SpaceInvaderOne for the help on editing the doacker container files.