mirror of
https://github.com/TrezOne/docker-mods-uptime-kuma-timeout-fix.git
synced 2026-07-12 22:53:47 -04:00
Lidarr: flac2mp3 Release 2.3
## What's Changed - **Complete re-write of the core script to use shell instead of AWK.** - **New:** Better use of the Lidarr API, including: - Using it to delete or recycle old tracks - No more artist refresh/rescan (which took forever) (issue thecaptain989/lidarr-flac2mp3#39) - Imports the converted tracks directly - Fixed logging of curl errors and improved error handling - Removed unnecessary function - Improved track import JSON generator logic - Added check for 'queued' job status - Use tag or branch name as Docker image tag - Added GitHub Container Registry push - Added GitHub container Registry labels
This commit is contained in:
@@ -5,20 +5,20 @@ A [Batch Mode](./README.md#batch-mode) is also supported that allows usage outsi
|
||||
|
||||
>**NOTE:** This mod supports Linux OSes only.
|
||||
|
||||
Production Container info: 
|
||||
Development Container info:
|
||||

|
||||

|
||||
Production Container info: 
|
||||

|
||||
|
||||
# Installation
|
||||
1. Pull the [linuxserver/lidarr](https://hub.docker.com/r/linuxserver/lidarr "LinuxServer.io's Lidarr container") docker image from Docker Hub:
|
||||
`docker pull linuxserver/lidarr:latest`
|
||||
1. Pull the [linuxserver/lidarr](https://hub.docker.com/r/linuxserver/lidarr "LinuxServer.io's Lidarr container") docker image from GitHub Container Registry or Docker Hub:
|
||||
`docker pull lscr.io/linuxserver/lidarr:latest`
|
||||
|
||||
2. Configure the Docker container with all the port, volume, and environment settings from the *original container documentation* here:
|
||||
**[linuxserver/lidarr](https://hub.docker.com/r/linuxserver/lidarr "Docker container")**
|
||||
1. Add a **DOCKER_MODS** environment variable to the `docker run` command, as follows:
|
||||
- Dev/test release: `-e DOCKER_MODS=thecaptain989/lidarr-flac2mp3:latest`
|
||||
- Stable release: `-e DOCKER_MODS=linuxserver/mods:lidarr-flac2mp3`
|
||||
- Dev/test release: `-e DOCKER_MODS=thecaptain989/lidarr-flac2mp3:latest`
|
||||
|
||||
*Example Docker CLI Configuration*
|
||||
```shell
|
||||
@@ -33,7 +33,7 @@ Production Container info: .<br/>2 includes API and FFmpeg output.
|
||||
-d, --debug|\[\<level\>\]|Enables debug logging. Level is optional.<br/>Default of 1 (low).<br/>2 includes JSON and FFmpeg output.<br/>3 contains even more JSON output.
|
||||
-b, --bitrate|\<bitrate\>|Sets the output quality in constant bits per second (CBR).<br/>Examples: 160k, 240k, 300000<br/>**Note:** May not be specified with `-v`, `-a`, or `-e`.
|
||||
-v, --quality|\<quality\>|Sets the output variable bit rate (VBR).<br/>Specify a value between 0 and 9, with 0 being the highest quality.<br/>See the [FFmpeg MP3 Encoding Guide](https://trac.ffmpeg.org/wiki/Encode/MP3) for more details.<br/>**Note:** May not be specified with `-b`, `-a`, or `-e`.
|
||||
-a, --advanced|\"\<options\>\"|Advanced ffmpeg options.<br/>The specified `options` replace all script defaults and are sent directly to ffmpeg.<br/>The `options` value must be enclosed in quotes.<br/>See [FFmpeg Options](https://ffmpeg.org/ffmpeg.html#Options) for details on valid options, and [Guidelines for high quality audio encoding](https://trac.ffmpeg.org/wiki/Encode/HighQualityAudio) for suggested usage.<br/>**Note:** Requires the `-e` option to also be specified. May not be specified with `-v` or `-b`.<br/>![warning] **WARNING:** You must specify an audio codec (by including a `-c:a <codec>` ffmpeg option) or the resulting file will contain no audio!<br/>![warning] **WARNING:** Invalid `options` could result in script failure!
|
||||
-e, --extension|\<extension\>|Sets the output file extension.<br/>The extension may be prefixed by a dot (".") or not.<br/>Example: .ogg<br/>**Note:** Requires the `-a` option to also be specified. May not be specified with `-v` or `-b`.
|
||||
-f, --file|<audio_file>|If included, the script enters **[Batch Mode](./README.md#batch-mode)** and converts the specified audio file.<br/>![warning] **WARNING:** Do not use this argument when called from Lidarr!
|
||||
-o, --output|\<directory\>|Converted audio file(s) are saved to `directory` instead of being located in the same directory as the source audio file.<br/>The path will be created if it does not exist.
|
||||
-k, --keep-file| |Do not delete the source file or move it to the Lidarr Recycle bin.<br/>**Note:** This also disables triggering a Lidarr rescan after conversion.
|
||||
-r, --regex|'\<regex\>'|Sets the regular expression used to select input files.<br/>The `regex` value should be enclosed in single quotes and escaped properly.<br/>Defaults to `"\.flac$"`.
|
||||
-k, --keep-file| |Do not delete the source file or move it to the Lidarr Recycle bin.<br/>**Note:** This also disables importing the new files into Lidarr after conversion.
|
||||
-r, --regex|'\<regex\>'|Sets the regular expression used to select input files.<br/>The `regex` value should be enclosed in single quotes and escaped properly.<br/>Defaults to `[.]flac$`.
|
||||
-t, --tags|\<taglist\>|Comma separated list of metadata tags to apply automated corrections to.<br/>See [Metadata Corrections](./README.md#metadata-corrections) section.
|
||||
--help| |Display help and exit.
|
||||
--version| |Display version and exit.
|
||||
@@ -100,11 +100,11 @@ By default, the script only matches and interacts with FLAC files (specifically,
|
||||
|
||||
Files are passed to the script with the full Linux path intact. (Ex: `/path/to/audio/a-ha/Hunting High and Low/01 Take on Me.mp3`). Craft your regex with this in mind.
|
||||
|
||||
![warning] **NOTE:** Escaping special regex characters (like a dot `.`) requires a double backslash, _even when single quoted!_ This is because **awk** (the program that processes audio files in the script) in most cases [strips a single backslash](https://www.gnu.org/software/gawk/manual/html_node/Escape-Sequences.html "GNU awk reference") from strings. Double quoted or unquoted strings require _four_ backslashes to preserve a regex escape because the bash shell will process the escapes first.
|
||||
![warning] **NOTE:** Escaping special regex characters (like a dot `.`) requires a double backslash or a character class. A character class (i.e. `[.]`) is recommended because backslashes can be stripped by the bash shell and getting this right can be confusing.
|
||||
|
||||
For example, to convert all audio files to AAC audio files, use the following options:
|
||||
```
|
||||
-a "-y -map 0 -c:a aac -b:a 240k -c:v copy" -e m4a --regex '\\.[^.]*$'
|
||||
-a "-y -map 0 -c:a aac -b:a 240k -c:v copy" -e m4a --regex '[.][^.]*$'
|
||||
```
|
||||
|
||||
Regular expression syntax is beyond the scope of this document. See this [tutorial](https://www.regular-expressions.info/tutorial.html "Regular Expressions Tutorial") for more information. Regex patterns may be tested [here](http://regexstorm.net/tester "regex tester").
|
||||
@@ -114,13 +114,13 @@ Regular expression syntax is beyond the scope of this document. See this [tutor
|
||||
-b 320k # Output 320 kbit/s MP3 (non-VBR; same as default behavior)
|
||||
-v 0 # Output variable bitrate MP3, VBR 220-260 kbit/s
|
||||
-d -b 160k # Enable debugging level 1, and output a 160 kbit/s MP3
|
||||
-r '\\.[^.]*$' # Convert any file to MP3 (not just FLAC)
|
||||
-r '[.][^.]*$' # Convert any file to MP3 (not just FLAC)
|
||||
-a "-c:v libtheora -map 0 -q:v 10 -c:a libopus -b:a 192k" -e .opus
|
||||
# Convert to Opus format, 192 kbit/s, cover art
|
||||
-a "-vn -c:a libopus -b:a 192K" -e .opus -r '\.mp3$'
|
||||
-a "-vn -c:a libopus -b:a 192K" -e .opus -r '[.]mp3$'
|
||||
# Convert .mp3 files to Opus format, 192 kbit/s, no cover art
|
||||
-a "-y -map 0 -c:a aac -b:a 240k -c:v copy" -e mp4
|
||||
# Convert to MP4 format, using AAC 240 kbit/s audio, cover art, overwrite file
|
||||
-a "-y -map 0 -c:a aac -b:a 240k -c:v copy" -e m4a
|
||||
# Convert to M4A format, using AAC 240 kbit/s audio, cover art, overwrite file
|
||||
--file "/path/to/audio/a-ha/Hunting High and Low/01 Take on Me.flac"
|
||||
# Batch Mode
|
||||
# Output 320kbit/s MP3
|
||||
@@ -161,14 +161,14 @@ The `flac2mp3.sh` script also allows the use of arguments provided by the `FLAC2
|
||||
|
||||
For example, the following value would convert any .mp3 to Opus:
|
||||
```
|
||||
-e FLAC2MP3_ARGS='-a "-vn -c:a libopus -b:a 192k" -e .opus -r "\\.mp3$"'
|
||||
-e FLAC2MP3_ARGS='-a "-vn -c:a libopus -b:a 192k" -e .opus -r "[.]mp3$"'
|
||||
```
|
||||
|
||||
Make sure to correctly use quotes and/or escape special characters when using this method. (See [regex notes](./README.md#technical-notes-on-regex) above.)
|
||||
In Docker Compose, the previous command would need an extra `$` to match the end-of-line:
|
||||
```yaml
|
||||
environment:
|
||||
- FLAC2MP3_ARGS=-a "-vn -c:a libopus -b:a 192k" -e .opus -r '\\.mp3$$'
|
||||
- FLAC2MP3_ARGS=-a "-vn -c:a libopus -b:a 192k" -e .opus -r '[.]mp3$$'
|
||||
```
|
||||
|
||||
*Example Synology Configuration*
|
||||
@@ -187,7 +187,7 @@ Using this function, you can easily process all of your audio files in any subdi
|
||||
#### Script Execution Differences in Batch Mode
|
||||
Because the script is not called from within Lidarr, expect the following behavior while in Batch Mode:
|
||||
* *The file name must be specified on the command line*<br/>(The `-f` option places the script in Batch Mode)
|
||||
* *Lidarr APIs are not called and its database is not updated.*<br/>This may require a manual rescan of converted music files.
|
||||
* *Lidarr APIs are not called and its database is not updated.*<br/>This may require a manual import of converted music files or an artist rescan.
|
||||
* *Original audio files are deleted.*<br/>The Recycle Bin function is not available. (Modifiable using the `-k` option.)
|
||||
|
||||
#### Batch Example
|
||||
@@ -226,7 +226,7 @@ This would not be possible without the following:
|
||||
|
||||
[Lidarr](https://lidarr.audio/ "Lidarr homepage")
|
||||
[LinuxServer.io Lidarr](https://hub.docker.com/r/linuxserver/lidarr "Lidarr Docker container") container
|
||||
[LinuxServer.io Docker Mods](https://hub.docker.com/r/linuxserver/mods "Docker Mods containers") project
|
||||
[LinuxServer.io Docker Mods](https://github.com/linuxserver/docker-mods "Docker Mods containers") project
|
||||
[ffmpeg](https://ffmpeg.org/ "FFmpeg homepage")
|
||||
Icons made by [Freepik](https://www.freepik.com) from [Flaticon](https://www.flaticon.com/)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user