Skip to content

Commit da582cc

Browse files
authored
Merge pull request #1078 from TheCaptain989/radarr-striptracks
radarr: striptracks release 2.18.0
2 parents f598df4 + 013aeba commit da582cc

File tree

5 files changed

+322
-195
lines changed

5 files changed

+322
-195
lines changed

.github/workflows/BuildImage.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
echo "MULTI_ARCH=${{ env.MULTI_ARCH }}" >> $GITHUB_OUTPUT
3333
if [[ -z "${{ env.MOD_VERSION }}" ]]; then
3434
# **** If the mod needs to be versioned, set the versioning logic below. Otherwise leave as is. ****
35-
MOD_VERSION="2.17.0"
35+
MOD_VERSION="2.18.0"
3636
else
3737
MOD_VERSION=${{ env.MOD_VERSION }}
3838
echo "MOD_VERSION_OVERRIDE=true" >> $GITHUB_OUTPUT

Dockerfile

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

33
## Buildstage ##
4-
FROM ghcr.io/linuxserver/baseimage-alpine:3.20 AS buildstage
4+
FROM ghcr.io/linuxserver/baseimage-alpine:3.22 AS buildstage
55
ARG MOD_VERSION
66

77
# copy local files

README.md

Lines changed: 43 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -181,22 +181,25 @@ graph LR
181181
A[Command-Line]
182182
B["Environment
183183
Variable"]
184-
C["Quality
185-
Profile"]
184+
C{"Quality
185+
Profile"}
186186
D["Custom
187187
Formats"]
188188
E["Language Profile
189189
(Sonarr only)"]
190+
F(["Exit"])
190191
A-->B
191192
B-->C
192193
C-- 'Any' -->D
194+
C-- "--skip-profile" -->F
193195
D-->E
194196
```
195197

196198
Descriptively, these steps are:
197199
1. Command-line arguments override all automatic language selection.
198200
2. Environment variable is checked for arguments.
199201
3. If there are no command-line or environment variable arguments, the video's *Quality Profile* is examined for a language configuration (only supported in Radarr).
202+
1. If the *Quality Profile* name matches one of the names specified with the `--skip-profile` option, stop processing and exit.
200203
4. If there is no *Quality Profile* language **or** it is set to 'Any', then examine the *Custom Formats* and scores associated with the quality profile.
201204
All language conditions with positive scores *and* Negated conditions with negative scores *and* non-Negated Except Language conditions with negative scores are selected.
202205
5. If the *Custom Format* scores are zero (0) or there are none with configured language conditions, use the *Language Profile* (only supported in Sonarr v3)
@@ -210,18 +213,22 @@ All language conditions with positive scores *and* Negated conditions with negat
210213
The script also supports command-line arguments that will override the automatic language detection. More granular control can therefore be exerted or extended using tagging and defining multiple *Connect* scripts (this is native Radarr/Sonarr functionality outside the scope of this documentation).
211214

212215
The syntax for the command-line is:
213-
`striptracks.sh [{-a|--audio} <audio_languages> [{-s|--subs} <subtitle_languages>] [{-f|--file} <video_file>]] [--reorder] [--disable-recycle] [{-l|--log} <log_file>] [{-c|--config} <config_file>] [{-p|--priority} {idle|low|medium|high}] [{-d|--debug} [<level>]]`
216+
`striptracks.sh [{-a|--audio} <audio_languages[+modifier]> [{-s|--subs} <subtitle_languages[+modifier]>] [{-f|--file} <video_file>]] [--reorder] [--disable-recycle] [--skip-profile <profile_name>]... [--set-default-audio <language_code[=name]>] [--set-default-subs <language_code[=name]>]
217+
[{-l|--log} <log_file>] [{-c|--config} <config_file>] [{-p|--priority} {idle|low|medium|high}] [{-d|--debug} [<level>]]`
214218

215219
<details>
216220
<summary>Table of Command-Line Arguments</summary>
217221

218222
Option|Argument|Description
219223
---|---|---
220-
`-a`, `--audio`|`<audio_languages>`|Audio languages to keep<br/>ISO 639-2 code(s) prefixed with a colon (`:`)<br/>Each code may optionally be followed by a plus (`+`) and one or more [modifiers](#language-code-modifiers).
221-
`-s`, `--subs`|`<subtitle_languages>`|Subtitle languages to keep<br/>ISO 639-2 code(s) prefixed with a colon (`:`)<br/>Each code may optionally be followed by a plus (`+`) and one or more modifiers.
224+
`-a`, `--audio`|`<audio_languages[+modifier]>`|Audio languages to keep<br/>ISO 639-2 code(s) prefixed with a colon (`:`)<br/>Each code may optionally be followed by a plus (`+`) and one or more [modifiers](#language-code-modifiers).
225+
`-s`, `--subs`|`<subtitle_languages[+modifier]>`|Subtitle languages to keep<br/>ISO 639-2 code(s) prefixed with a colon (`:`)<br/>Each code may optionally be followed by a plus (`+`) and one or more modifiers.
222226
`-f`, `--file`|`<video_file>`|If included, the script enters **[Batch Mode](#batch-mode)** and converts the specified video file.<br/>Requires the `--audio` option.<br/>![notes] **Do not** use this argument when called from Radarr or Sonarr!
223227
`--reorder`| |Reorder audio and subtitles tracks to match the language code order specified in the `<audio_languages>` and `<subtitle_languages>` arguments.
224228
`--disable-recycle`| |Disable recycle bin use, even if configured in Radarr/Sonarr
229+
`--skip-profile`|`<profile_name>`|Skip processing if the video was downloaded using the specified Quality Profile name. May be specified multiple times to skip multiple profiles.
230+
`--set-default-audio`|`<language_code[=name]>`|Set the default audio track to the first track of the specified language. Only one language code is allowed. If specified, all other tracks are marked as not default.<br/>The code may optionally be followed by an equals (`=`) and a [track name](#setting-default-track) matching string.
231+
`--set-default-subs`|`<language_code[=name]>`|Set the default subtitles track to the first track of the specified language. Only one language code is allowed. If specified, all other tracks are marked as not default.<br/>The code may optionally be followed by an equals (`=`) and a track name string.
225232
`-l`, `--log`|`<log_file>`|The log filename<br/>Default is `/config/log/striptracks.txt`
226233
`-c`, `--config`|`<config_file>`|Radarr/Sonarr XML configuration file<br/>Default is `/config/config.xml`
227234
`-p`, `--priority`|`idle`, `low`, `medium`, `high`|CPU and I/O process priority for mkvmerge<br/>Default is `medium`<br/>![notes] High priority can consume all system resources. When processing a large video file your system may become unresponsive!
@@ -246,14 +253,19 @@ Multiple codes may be concatenated, such as `:eng:spa` for both English and Span
246253
> If no subtitle language is detected via Radarr/Sonarr configuration or specified on the command-line, all subtitles are removed.
247254

248255
### Language Code Modifiers
249-
Each language code can optionally be followed by a plus (`+`) and one or more modifier characters. Supported modifiers are:
256+
Each language code can optionally be followed by a plus (`+`) and one or more modifier characters. Supported modifiers are in the table below.
257+
258+
<details>
259+
<summary>Table of Language Code Modifiers</summary>
250260

251261
Modifier|Function
252262
---|---
253263
`f`|Selects only tracks with the forced flag set
254264
`d`|Selects only tracks with the default flag set
255265
`[0-9]`|Specifies the maximum number of tracks to select.<br/>Based on the order of the tracks in the original source video.
256266

267+
</details>
268+
257269
These modifiers must be applied to each language code you want to modify. They may be used with either audio or subtitles codes.
258270
For example, the following options, `--audio :org:any+d --subs :eng+1:any+f` would keep:
259271
- All original language audio tracks, and all Default audio tracks regardless of language
@@ -265,6 +277,30 @@ Modifiers may be combined, such as `:any+fd` to keep all forced and all default
265277
> Note the exact phrasing of the previous sentence. There is nuance here that is not obvious.
266278
> `:any+fd` is equivalent to `:any+f:any+d`, but `:eng+1d` is **not** the same as `:eng+1:eng+d`.
267279

280+
### Setting Default Track
281+
Use the `--set-default` options to choose tracks that appear first when the video is played. Only one audio and one subtitles track may be set as default. The language code is the same colon (`:`) prepended ISO 639-2 language code used with the `--audio` and `--subs` options.
282+
The first track of the specified language will have its default flag set and all other tracks (of any language) will have their default flag disabled.
283+
284+
The language code can optionally be follow by an equals (`=`) and a string which is used to match against the track name. The first track that matches the specified language and with a name that matches the string will be set to default.
285+
The string matching uses a substring and is case insensitive. You can use this to set the default subtitles track to hearing impared (SDH), or the audio track to your preferred language.
286+
287+
The setting of default track flags occurs after the track selection logic.
288+
289+
> [!NOTE]
290+
> This is not a robust feature. It relies heavily on the track order and names from the source video file.
291+
> You may therefore not obtain consistent results.
292+
293+
<details>
294+
<summary>Track Name Examples</summary>
295+
296+
If you want to set the default subtitles track to the first hearing impared English track, you would use:
297+
`--set-default-subs :eng=SDH`
298+
299+
To set the default audio track to Dutch:
300+
`--set-default-audio :dut`
301+
302+
</details>
303+
268304
### Any language code
269305
The `:any` language code is a special code. When used, the script will preserve all language tracks, regardless of how they are tagged in the source video.
270306

@@ -452,6 +488,7 @@ Because the script is not called from within Radarr or Sonarr, their database is
452488
* *The filename must be specified on the command-line.*<br/>The `-f` option places the script in Batch Mode
453489
* *No audio or subtitles language detection occurs.*<br/>Both the audio and subtitles languages must be specified on the command-line.
454490
* *The `:org` language code is meaningless.*<br/>The original video language cannot be determined.
491+
* *Profile skipping is not available.*
455492
* *The resultant MKV embedded title attribute is set to the basename of the file minus the extension.*<br/>The canonical name of the movie/TV show cannot otherwise be determined.
456493
* *Radarr or Sonarr APIs are not called and their database is not updated.*<br/>This may require a manual rescan of converted videos.
457494
* *Original video files are deleted.*<br/>The Recycle Bin function is not available.

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.16.x | :heavy_check_mark: |
10-
| < 2.16 | :x: |
9+
| 2.18.x | :heavy_check_mark: |
10+
| < 2.18 | :x: |
1111

1212
## Reporting a Vulnerability
1313

0 commit comments

Comments
 (0)