mirror of
https://github.com/TrezOne/docker-mods-uptime-kuma-timeout-fix.git
synced 2026-06-29 11:42:55 -04:00
Release 2.4.3
This commit is contained in:
@@ -1,16 +1,18 @@
|
||||
# About
|
||||
A [Docker Mod](https://github.com/linuxserver/docker-mods) for the LinuxServer.io Lidarr Docker container that uses ffmpeg and a script to automatically convert downloaded FLAC (or other format) files to MP3s. Default output quality is 320Kbps constant bit rate.
|
||||
Advanced options act as a light wrapper to ffmpeg, allowing conversion to any supported audio format, including AAC, AC3, Opus, and many others.
|
||||
A [Batch Mode](./README.md#batch-mode) is also supported that allows usage outside of Lidarr.
|
||||
A [Batch Mode](#batch-mode) is also supported that allows usage outside of Lidarr.
|
||||
|
||||
> [!NOTE]
|
||||
> This mod supports Linux OSes only.
|
||||
|
||||
>![notes] This mod supports Linux OSes only.
|
||||
<!-- markdownlint-disable -->
|
||||
Production Container info: [](https://hub.docker.com/r/linuxserver/mods/tags?name=lidarr-flac2mp3 "Docker image size")
|
||||
[](https://github.com/linuxserver/docker-mods/pkgs/container/mods "GitHub package pulls")
|
||||
Development Container info:
|
||||
[](https://hub.docker.com/r/thecaptain989/lidarr-flac2mp3 "Docker image size")
|
||||
[](https://hub.docker.com/r/thecaptain989/lidarr-flac2mp3 "Docker container pulls")
|
||||
[](https://github.com/TheCaptain989/lidarr-flac2mp3/actions/workflows/BuildImage.yml "BuildImage Job")
|
||||
[](https://github.com/TheCaptain989/lidarr-flac2mp3/actions/workflows/BuildImage.yml "BuildImage Job")
|
||||
<!-- markdownlint-restore -->
|
||||
|
||||
# Installation
|
||||
@@ -84,16 +86,21 @@ Development Container info:
|
||||
|
||||
This will use the defaults to create a 320Kbps MP3 file.
|
||||
|
||||
>![notes] *For any other setting, you **must** use one of the supported methods to pass arguments to the script. See the [Command-Line Syntax](./README.md#command-line-syntax) section below.*
|
||||
> [!IMPORTANT]
|
||||
> For any other setting, you **must** use one of the supported methods to pass arguments to the script. See the [Command-Line Syntax](#command-line-syntax) section below.
|
||||
|
||||
# Usage
|
||||
New file(s) will be placed in the same directory as the original FLAC file(s) (unless redirected with the `--output` option below) with permissions preserved. Existing files with the same track name will be overwritten. Owner is preserved if the script is executed as root.
|
||||
|
||||
By default, if you've configured Lidarr's **Recycle Bin** path correctly, the original audio file will be moved there.
|
||||
>![warning] **WARNING:** If you have *not* configured the Recycle Bin, the original FLAC audio file(s) will be deleted and permanently lost. This behavior may be modified with the `--keep-file` option.
|
||||
> [!TIP]
|
||||
> By default, if you've configured Lidarr's **Recycle Bin** path correctly, the original audio file will be moved there.
|
||||
|
||||
> [!CAUTION]
|
||||
> If you have *not* configured the Recycle Bin, the original FLAC audio file(s) will be deleted and permanently lost. This behavior may be modified with the `--keep-file` option.
|
||||
|
||||
## Command-Line Syntax
|
||||
>![notes] The *Arguments* field for Custom Scripts was removed in Lidarr release [v0.7.0.1347](https://github.com/lidarr/Lidarr/commit/b9d240924f8965ebb2c5e307e36b810ae076101e "Lidarr commit notes") due to security concerns.
|
||||
> [!NOTE]
|
||||
> The *Arguments* field for Custom Scripts was removed in Lidarr release [v0.7.0.1347](https://github.com/lidarr/Lidarr/commit/b9d240924f8965ebb2c5e307e36b810ae076101e "Lidarr commit notes") due to security concerns.
|
||||
|
||||
### Options and Arguments
|
||||
The script may be called with optional command-line arguments.
|
||||
@@ -106,25 +113,28 @@ The syntax for the command-line is:
|
||||
|
||||
Option|Argument|Description
|
||||
---|---|---
|
||||
-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<!-- markdownlint-disable-line MD013 -->|\"\<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 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$`.
|
||||
-l, --log|\<log_file\>|The log filename<br/>Default of /config/log/flac2mp3.txt
|
||||
-t, --tags|\<taglist\>|Comma separated list of metadata tags to apply automated corrections to.<br/>See [Metadata Corrections](./README.md#metadata-corrections) section.
|
||||
-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.
|
||||
--help| |Display help and exit.
|
||||
--version| |Display version and exit.
|
||||
`-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`<!-- markdownlint-disable-line MD013 -->|`"<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](#batch-mode)** and converts the specified audio file.<br/>![note] **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 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$`.
|
||||
`-l`, `--log`|`<log_file>`|The log filename<br/>Default of /config/log/flac2mp3.txt
|
||||
`-t`, `--tags`|`<taglist>`|Comma separated list of metadata tags to apply automated corrections to.<br/>See [Metadata Corrections](#metadata-corrections) section.
|
||||
`-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.
|
||||
`--help`| |Display help and exit.
|
||||
`--version`| |Display version and exit.
|
||||
|
||||
</details>
|
||||
|
||||
If neither `-b`, `-v`, `-a`, or `-e` options are specified, the script will default to a constant 320Kbps MP3.
|
||||
|
||||
#### Technical notes on advanced options
|
||||
<details>
|
||||
<summary>Advanced Options Details</summary>
|
||||
|
||||
The `-a` option effectively makes the script a generic wrapper for ffmpeg. FFmpeg is executed once per track with only the loglevel, input filename, and output filename being set. All other options are passed unparsed to the command-line.
|
||||
|
||||
The exact format of the executed ffmpeg command is:
|
||||
@@ -133,17 +143,20 @@ The exact format of the executed ffmpeg command is:
|
||||
ffmpeg -loglevel error -nostdin -i "input.flac" ${options} "output.${extension}"
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
#### Technical notes on regular expressions
|
||||
<details>
|
||||
<summary>Regular Expression Details</summary>
|
||||
|
||||
<!-- textlint-disable terminology -->
|
||||
|
||||
By default, the script only matches and interacts with FLAC files (specifically, files ending in ".flac"). The `-r` option allows the script to match on a user specified regular expression (i.e. "regex") pattern.
|
||||
By default, the script only matches and interacts with FLAC files (specifically, files ending in ".flac"). The `--regex` option allows the script to match on a user specified regular expression (i.e. "regex") pattern.
|
||||
|
||||
<!-- textlint-enable -->
|
||||
|
||||
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 regular expression with this in mind.
|
||||
|
||||
>![notes] Escaping special regular expression 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:
|
||||
|
||||
```shell
|
||||
@@ -152,8 +165,12 @@ For example, to convert all audio files to AAC audio files, use the following op
|
||||
|
||||
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. Regular expression patterns may be tested [here](http://regexstorm.net/tester "regex tester").
|
||||
|
||||
## Examples
|
||||
</details>
|
||||
|
||||
> [!TIP]
|
||||
> Escaping special regular expression 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.
|
||||
|
||||
## Examples
|
||||
<details>
|
||||
<summary>Command-line Examples</summary>
|
||||
|
||||
@@ -178,11 +195,15 @@ Regular expression syntax is beyond the scope of this document. See this [tutor
|
||||
</details>
|
||||
|
||||
## Wrapper Scripts
|
||||
To supply arguments to the script, you must either use one of the included wrapper scripts, create a custom wrapper script, or set the `FLAC2MP3_ARGS` [environment variable](./README.md#environment-variable).
|
||||
To supply arguments to the script, you must either use one of the included wrapper scripts, create a custom wrapper script, or set the `FLAC2MP3_ARGS` [environment variable](#environment-variable).
|
||||
|
||||
> [!TIP]
|
||||
> If you followed the Linuxserver.io recommendations when configuring your container, the `/config` directory will be mapped to an external storage location.
|
||||
> It is therefore recommended to place custom scripts in the `/config` directory so they will survive container updates, but they may be placed anywhere that is accessible by Lidarr.
|
||||
|
||||
### Included Wrapper Scripts
|
||||
For your convenience, several wrapper scripts are included in the `/usr/local/bin/` directory.
|
||||
You may use any of these scripts in place of the `flac2mp3.sh` mentioned in the [Installation](./README.md#installation) section above.
|
||||
You may use any of these scripts in place of the `flac2mp3.sh` mentioned in the [Installation](#installation) section above.
|
||||
|
||||
<details>
|
||||
<summary>List of scripts</summary>
|
||||
@@ -198,7 +219,10 @@ flac2alac.sh # Convert to Apple Lossless using an .m4a extension
|
||||
</details>
|
||||
|
||||
### Example Wrapper Script
|
||||
To configure an entry from the [Examples](./README.md#examples) section above, create and save a file called `flac2mp3-custom.sh` to `/config` containing the following text:
|
||||
<details>
|
||||
<summary>Example Script</summary>
|
||||
|
||||
To configure an entry from the [Examples](#examples) section above, create and save a file called `flac2mp3-custom.sh` to `/config` containing the following text:
|
||||
|
||||
```shell
|
||||
#!/bin/bash
|
||||
@@ -212,27 +236,39 @@ Make it executable:
|
||||
chmod +x /config/flac2mp3-custom.sh
|
||||
```
|
||||
|
||||
Then put `/config/flac2mp3-custom.sh` in the **Path** field in place of `/usr/local/bin/flac2mp3.sh` mentioned in the [Installation](./README.md#installation) section above.
|
||||
Then put `/config/flac2mp3-custom.sh` in the **Path** field in place of `/usr/local/bin/flac2mp3.sh` mentioned in the [Installation](#installation) section above.
|
||||
|
||||
>![notes] If you followed the Linuxserver.io recommendations when configuring your container, the `/config` directory will be mapped to an external storage location. It is therefore recommended to place custom scripts in the `/config` directory so they will survive container updates, but they may be placed anywhere that is accessible by Lidarr.
|
||||
</details>
|
||||
|
||||
## Environment Variable
|
||||
The `flac2mp3.sh` script also allows the use of arguments provided by the `FLAC2MP3_ARGS` environment variable. This allows advanced use cases without having to provide a custom script.
|
||||
The script can also read arguments from the `FLAC2MP3_ARGS` environment variable. This allows advanced use cases without having to provide a custom wrapper script.
|
||||
|
||||
For example, the following value in your `docker run` command would convert any .mp3 to Opus:
|
||||
Make sure to correctly use quotes and/or escape special characters when using this method. (See [regular expression notes](#technical-notes-on-regular-expressions) above.)
|
||||
|
||||
```shell
|
||||
-e FLAC2MP3_ARGS='-a "-vn -c:a libopus -b:a 192k" -e .opus -r "[.]mp3$"'
|
||||
```
|
||||
> [!NOTE]
|
||||
> The environment variable is *only* used when **no** command-line arguments are present. **Any** command-line argument will disable the use of the environment variable.
|
||||
|
||||
Make sure to correctly use quotes and/or escape special characters when using this method. (See [regular expression notes](./README.md#technical-notes-on-regular-expressions) above.)
|
||||
In Docker Compose, the previous command would need an extra `$` to match the end-of-line:
|
||||
<details>
|
||||
<summary>Example Docker Compose</summary>
|
||||
|
||||
For example, the following lines in your `compose.yml` file would convert any .mp3 to Opus, and would need an extra `$` to escape the end-of-line regular expression match:
|
||||
|
||||
```yaml
|
||||
environment:
|
||||
- FLAC2MP3_ARGS=-a "-vn -c:a libopus -b:a 192k" -e .opus -r '[.]mp3$$'
|
||||
```
|
||||
|
||||
</details>
|
||||
<details>
|
||||
<summary>Example Docker Run Command</summary>
|
||||
|
||||
In a `docker run` command, it would be:
|
||||
|
||||
```shell
|
||||
-e FLAC2MP3_ARGS='-a "-vn -c:a libopus -b:a 192k" -e .opus -r "[.]mp3$"'
|
||||
```
|
||||
|
||||
</details>
|
||||
<details>
|
||||
<summary>Synology Screenshot</summary>
|
||||
|
||||
@@ -241,29 +277,32 @@ environment:
|
||||
|
||||
</details>
|
||||
|
||||
>![notes] The environment variable settings are *only* used when **no** command-line arguments are present. **Any** command-line argument will disable the use of the environment variable.
|
||||
|
||||
## Triggers
|
||||
The only events/notification triggers that are supported are **On Release Import** and **On Upgrade**
|
||||
The only events/notification triggers that are supported are **On Release Import** and **On Upgrade**. The script will log an error if executed by any other trigger.
|
||||
|
||||
## Batch Mode
|
||||
Batch mode allows the script to be executed independently of Lidarr. It converts the file specified on the command-line and ignores any environment variables that are normally expected to be set by the music management program.
|
||||
|
||||
Using this function, you can easily process all of your audio files in any subdirectory at once. See the [Batch Example](./README.md#batch-example) below.
|
||||
Using this function, you can easily process all of your audio files in any subdirectory at once. See the [Batch Example](#batch-example) below.
|
||||
|
||||
### Script Execution Differences in Batch Mode
|
||||
Because the script is not called from within Lidarr, expect the following behavior while in Batch Mode:
|
||||
* *The filename must be specified on the command-line*<br/>(The `-f` option places the script in Batch Mode)
|
||||
* *The filename 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 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.)
|
||||
* *Original audio files are deleted.* (Modifiable using the `-k` option.)<br/>The Recycle Bin function is not available.
|
||||
|
||||
### Batch Example
|
||||
<details>
|
||||
<summary>Batch Mode Example</summary>
|
||||
|
||||
To convert all .FLAC files in the `/music` directory to Apple Lossless Audio Codec (ALAC), enter the following at the Linux command-line:
|
||||
|
||||
```shell
|
||||
find /music/ -type f -name "*.flac" | while read file; do /usr/local/bin/flac2mp3.sh -f "$file" -a "-c:a alac" -e m4a; done
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
## Metadata Corrections
|
||||
**This feature is not meant for general purpose use.** It is only documented here for completeness.
|
||||
|
||||
@@ -274,9 +313,9 @@ List of supported tags and metadata corrections that are applied:
|
||||
|
||||
Tag|Original|Correction
|
||||
---|---|---
|
||||
title|Parenthesis for live\|remix, etc. "()"|Square brackets "\[]"
|
||||
disc|1|1/1
|
||||
genre|/Pop/|"Pop"
|
||||
`title`|Parenthesis for live\|remix, etc. "()"|Square brackets "\[]"
|
||||
`disc`|1|1/1
|
||||
`genre`|/Pop/|"Pop"
|
||||
|/Indie/|"Alternative & Indie"
|
||||
|/Industrial/|"Industrial Rock"
|
||||
|/Electronic/|"Electronica & Dance"
|
||||
@@ -294,11 +333,12 @@ This log can be downloaded from Lidarr under *System* > *Log Files*. The log fi
|
||||
|
||||
Log rotation is performed, with 5 log files of 1MB each kept, matching Lidarr's log retention.
|
||||
|
||||
>![warning] If debug logging is enabled with a level above 1, the log file can grow very large very quickly and is much more likely to be rotated. *Do not leave high-level debug logging enabled permanently.*
|
||||
> [!CAUTION]
|
||||
> If debug logging is enabled with a level above 1, the log file can grow very large very quickly and is much more likely to be rotated. *Do not leave high-level debug logging enabled permanently.*
|
||||
|
||||
# Uninstall
|
||||
To completely remove the mod:
|
||||
1. Delete the custom script from Lidarr's *Settings* > *Connect* screen that you created in the [Installation](./README.md#installation) section above.
|
||||
1. Delete the custom script from Lidarr's *Settings* > *Connect* screen that you created in the [Installation](#installation) section above.
|
||||
2. Stop and delete the Lidarr container.
|
||||
3. Exclude the **DOCKER_MODS** environment variable from your `compose.yaml` file or the `docker run` command when re-creating the Lidarr container.
|
||||
|
||||
@@ -315,4 +355,4 @@ This would not be possible without the following:
|
||||
Icons made by [Freepik](https://www.freepik.com) from [Flaticon](https://www.flaticon.com/)
|
||||
|
||||
[warning]: .assets/warning.png "Warning"
|
||||
[notes]: .assets/notes.png "Note"
|
||||
[note]: .assets/notes.png "Note"
|
||||
|
||||
Reference in New Issue
Block a user