4.5 KiB
A Docker Mod for the LinuxServer.io Lidarr Docker container that adds a script to automatically convert downloaded FLAC files to MP3s using ffmpeg. Default quality is 320Kbps.
NOTE: This mod support Linux OSes only.
Installation
-
Pull the linuxserver/lidarr docker image from Docker Hub:
docker pull linuxserver/lidarr:latest -
Configure the Docker container with all the port, volume, and environment settings from the original container documentation here:
linuxserver/lidarr -
After all of the above configuration is complete, to use ffmpeg, configure a custom script from the Settings->Connect screen and type the following in the Path field:
/usr/local/bin/flac2mp3.sh
Usage
New file(s) with an MP3 extension will be placed in the same directory as the original FLAC file(s). Existing MP3 files with the same track name will be overwritten.
If you've configured the Lidarr Recycle Bin path correctly, the original audio file will be moved there.
NOTE: If you have not configured the Recycle Bin, the original FLAC audio file(s) will be deleted and permanently lost.
Syntax
Note: The Arguments field for Custom Scripts was removed in Lidarr release v0.7.0.1347 due to security concerns. To support options with this version and later, a wrapper script can be manually created that will call flac2mp3.sh with the required arguments.
The script accepts two options which may be placed in the Arguments field:
[-d] [-b <bitrate>]
The -b bitrate option, if specified, sets the output quality in bits per second. If no -b option is specified, the script will default to 320Kbps.
The -d option enables debug logging.
Examples
-b 320k # Output 320 kilobits per second MP3 (same as default behavior)
-d -b 160k # Enable debugging, and output 160 kilobits per second MP3
Included Wrapper Script
For your convenience, a wrapper script to enable debugging is included in the /usr/local/bin/ directory.
Use this script in place of the flac2mp3.sh mentioned in the Installation section above.
flac2mp3-debug.sh # Enable debugging
Example Wrapper Script
To configure the last entry from the Examples section above, create and save a file called wrapper.sh to /usr/local/bin containing the following text:
#!/bin/bash
. /usr/local/bin/flac2mp3.sh -d -b 160k
Then put /usr/local/bin/wrapper.sh in the Path field in place of /usr/local/bin/flac2mp3.sh mentioned in the Installation section above.
Triggers
The only events/notification triggers that have been tested are On Release Import and On Upgrade
Logs
A log file is created for the script activity called:
/config/logs/flac2mp3.txt
This log can be downloaded from the Lidarr GUI under System->Log Files
Log rotation is performed, with 5 log files of 1MB each kept, matching Lidarr's log retention.
NOTE: If debug logging is enabled, the log file can grow very large very quickly. Do not leave debug logging enabled permanently.
Credits
This would not be possible without the following:
Lidarr
LinuxServer.io Lidarr container
LinuxServer.io Docker Mods project
ffmpeg

