Skip to content

Commit 3432605

Browse files
authored
Merge pull request #751 from TheCaptain989/lidarr-flac2mp3
Lidarr: flac2mp3 Release 2.3
2 parents 3dca0f6 + 7c16d43 commit 3432605

File tree

4 files changed

+458
-280
lines changed

4 files changed

+458
-280
lines changed

Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
# syntax=docker/dockerfile:1
22

3+
## Buildstage ##
34
FROM ghcr.io/linuxserver/baseimage-alpine:3.17 as buildstage
45

56
ARG MOD_VERSION
67

8+
# copy local files
79
COPY root/ /root-layer/
810

11+
# Add version to script
912
RUN \
1013
MOD_VERSION="${MOD_VERSION:-unknown}" && \
1114
sed -i -e "s/{{VERSION}}/$MOD_VERSION/" \
@@ -17,5 +20,5 @@ FROM scratch
1720

1821
LABEL maintainer="TheCaptain989"
1922

20-
# Copy local files
23+
# Add files from buildstage
2124
COPY --from=buildstage /root-layer/ /

README.md

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,20 @@ A [Batch Mode](./README.md#batch-mode) is also supported that allows usage outsi
55

66
>**NOTE:** This mod supports Linux OSes only.
77
8+
Production Container info: ![Docker Image Size](https://img.shields.io/docker/image-size/linuxserver/mods/lidarr-flac2mp3 "Container Size")
89
Development Container info:
910
![Docker Image Size](https://img.shields.io/docker/image-size/thecaptain989/lidarr-flac2mp3 "Container Size")
10-
![Docker Pulls](https://img.shields.io/docker/pulls/thecaptain989/lidarr-flac2mp3 "Container Pulls")
11-
Production Container info: ![Docker Image Size](https://img.shields.io/docker/image-size/linuxserver/mods/lidarr-flac2mp3 "Container Size")
11+
![Docker Pulls](https://img.shields.io/docker/pulls/thecaptain989/lidarr-flac2mp3 "Container Pulls")
1212

1313
# Installation
14-
1. Pull the [linuxserver/lidarr](https://hub.docker.com/r/linuxserver/lidarr "LinuxServer.io's Lidarr container") docker image from Docker Hub:
15-
`docker pull linuxserver/lidarr:latest`
14+
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:
15+
`docker pull lscr.io/linuxserver/lidarr:latest`
1616

1717
2. Configure the Docker container with all the port, volume, and environment settings from the *original container documentation* here:
1818
**[linuxserver/lidarr](https://hub.docker.com/r/linuxserver/lidarr "Docker container")**
1919
1. Add a **DOCKER_MODS** environment variable to the `docker run` command, as follows:
20-
- Dev/test release: `-e DOCKER_MODS=thecaptain989/lidarr-flac2mp3:latest`
2120
- Stable release: `-e DOCKER_MODS=linuxserver/mods:lidarr-flac2mp3`
21+
- Dev/test release: `-e DOCKER_MODS=thecaptain989/lidarr-flac2mp3:latest`
2222

2323
*Example Docker CLI Configuration*
2424
```shell
@@ -33,7 +33,7 @@ Production Container info: ![Docker Image Size](https://img.shields.io/docker/im
3333
-v /path/to/music:/music \
3434
-v /path/to/downloads:/downloads \
3535
--restart unless-stopped \
36-
ghcr.io/linuxserver/lidarr
36+
lscr.io/linuxserver/lidarr
3737
```
3838

3939
*Example Synology Configuration*
@@ -72,15 +72,15 @@ Where:
7272
7373
Option|Argument|Description
7474
---|---|---
75-
-d, --debug|\[\<level\>\]|Enables debug logging. Level is optional.<br/>Default of 1 (low).<br/>2 includes API and FFmpeg output.
75+
-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.
7676
-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`.
7777
-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`.
7878
-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!
7979
-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`.
8080
-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!
8181
-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.
82-
-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.
83-
-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$"`.
82+
-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.
83+
-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$`.
8484
-t, --tags|\<taglist\>|Comma separated list of metadata tags to apply automated corrections to.<br/>See [Metadata Corrections](./README.md#metadata-corrections) section.
8585
--help| |Display help and exit.
8686
--version| |Display version and exit.
@@ -100,11 +100,11 @@ By default, the script only matches and interacts with FLAC files (specifically,
100100
101101
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.
102102
103-
![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.
103+
![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.
104104
105105
For example, to convert all audio files to AAC audio files, use the following options:
106106
```
107-
-a "-y -map 0 -c:a aac -b:a 240k -c:v copy" -e m4a --regex '\\.[^.]*$'
107+
-a "-y -map 0 -c:a aac -b:a 240k -c:v copy" -e m4a --regex '[.][^.]*$'
108108
```
109109
110110
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
114114
-b 320k # Output 320 kbit/s MP3 (non-VBR; same as default behavior)
115115
-v 0 # Output variable bitrate MP3, VBR 220-260 kbit/s
116116
-d -b 160k # Enable debugging level 1, and output a 160 kbit/s MP3
117-
-r '\\.[^.]*$' # Convert any file to MP3 (not just FLAC)
117+
-r '[.][^.]*$' # Convert any file to MP3 (not just FLAC)
118118
-a "-c:v libtheora -map 0 -q:v 10 -c:a libopus -b:a 192k" -e .opus
119119
# Convert to Opus format, 192 kbit/s, cover art
120-
-a "-vn -c:a libopus -b:a 192K" -e .opus -r '\.mp3$'
120+
-a "-vn -c:a libopus -b:a 192K" -e .opus -r '[.]mp3$'
121121
# Convert .mp3 files to Opus format, 192 kbit/s, no cover art
122-
-a "-y -map 0 -c:a aac -b:a 240k -c:v copy" -e mp4
123-
# Convert to MP4 format, using AAC 240 kbit/s audio, cover art, overwrite file
122+
-a "-y -map 0 -c:a aac -b:a 240k -c:v copy" -e m4a
123+
# Convert to M4A format, using AAC 240 kbit/s audio, cover art, overwrite file
124124
--file "/path/to/audio/a-ha/Hunting High and Low/01 Take on Me.flac"
125125
# Batch Mode
126126
# Output 320kbit/s MP3
@@ -161,14 +161,14 @@ The `flac2mp3.sh` script also allows the use of arguments provided by the `FLAC2
161161
162162
For example, the following value would convert any .mp3 to Opus:
163163
```
164-
-e FLAC2MP3_ARGS='-a "-vn -c:a libopus -b:a 192k" -e .opus -r "\\.mp3$"'
164+
-e FLAC2MP3_ARGS='-a "-vn -c:a libopus -b:a 192k" -e .opus -r "[.]mp3$"'
165165
```
166166
167167
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.)
168168
In Docker Compose, the previous command would need an extra `$` to match the end-of-line:
169169
```yaml
170170
environment:
171-
- FLAC2MP3_ARGS=-a "-vn -c:a libopus -b:a 192k" -e .opus -r '\\.mp3$$'
171+
- FLAC2MP3_ARGS=-a "-vn -c:a libopus -b:a 192k" -e .opus -r '[.]mp3$$'
172172
```
173173
174174
*Example Synology Configuration*
@@ -187,7 +187,7 @@ Using this function, you can easily process all of your audio files in any subdi
187187
#### Script Execution Differences in Batch Mode
188188
Because the script is not called from within Lidarr, expect the following behavior while in Batch Mode:
189189
* *The file name must be specified on the command line*<br/>(The `-f` option places the script in Batch Mode)
190-
* *Lidarr APIs are not called and its database is not updated.*<br/>This may require a manual rescan of converted music files.
190+
* *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.
191191
* *Original audio files are deleted.*<br/>The Recycle Bin function is not available. (Modifiable using the `-k` option.)
192192
193193
#### Batch Example
@@ -226,7 +226,7 @@ This would not be possible without the following:
226226

227227
[Lidarr](https://lidarr.audio/ "Lidarr homepage")
228228
[LinuxServer.io Lidarr](https://hub.docker.com/r/linuxserver/lidarr "Lidarr Docker container") container
229-
[LinuxServer.io Docker Mods](https://hub.docker.com/r/linuxserver/mods "Docker Mods containers") project
229+
[LinuxServer.io Docker Mods](https://github.com/linuxserver/docker-mods "Docker Mods containers") project
230230
[ffmpeg](https://ffmpeg.org/ "FFmpeg homepage")
231231
Icons made by [Freepik](https://www.freepik.com) from [Flaticon](https://www.flaticon.com/)
232232

SECURITY.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ Only the latest major and minor version are supported.
66

77
| Version | Supported |
88
| ------- | ------------------ |
9-
| 2.2.x | :heavy_check_mark: |
10-
| < 2.2 | :x: |
9+
| 2.3.x | :heavy_check_mark: |
10+
| < 2.3 | :x: |
1111

1212
## Reporting a Vulnerability
1313

0 commit comments

Comments
 (0)