You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+20-19Lines changed: 20 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
# About
2
-
A [Docker Mod](https://github.com/linuxserver/docker-mods) for the LinuxServer.io Radarr/Sonarr v3 or higher Docker containers that adds a script to automatically strip out unwanted audio and subtitle tracks, keeping only the desired languages.
2
+
A [Docker Mod](https://github.com/linuxserver/docker-mods) for the LinuxServer.io Radarr/Sonarr v3 or higher Docker containers that adds a script to automatically strip out unwanted audio and subtitle tracks, keeping only the desired languages. A [Batch Mode](#batch-mode) is also supported that allows usage outside of Radarr/Sonarr.
3
3
4
4
**This unified script works in both Radarr and Sonarr. Use this mod in either container!**
5
5
@@ -85,7 +85,7 @@ Development Container info:
85
85
</details>
86
86
87
87
The script will detect the language(s) defined in Radarr/Sonarr for the movie or TV show and only keep the audio and subtitles selected.
88
-
Alternatively, a wrapper script or an environment variable may be used to more granularly define which tracks to keep. See [Wrapper Scripts](./README.md#wrapper-scripts) or [Environment Variable](./README.md#environment-variable) for more details.
88
+
Alternatively, a wrapper script or an environment variable may be used to more granularly define which tracks to keep. See [Wrapper Scripts](#wrapper-scripts) or [Environment Variable](#environment-variable) for more details.
89
89
90
90
> [!IMPORTANT]
91
91
> You **must** configure language(s) in Radarr/Sonarr *or* pass command-line arguments for the script to do anything! See the next section for an example.
@@ -127,7 +127,7 @@ The following is a simplified example and steps to configure Radarr so the scrip
127
127
</details>
128
128
129
129
Now, when Radarr imports a movie with the 'Any' Quality Profile, the script will keep only Original and English languages. This is equivalent to calling the script with `--audio :org:eng --subs :org:eng` command-line arguments.
130
-
See [Automatic Language Detection](./README.md#automatic-language-detection) for more details.
130
+
See [Automatic Language Detection](#automatic-language-detection) for more details.
131
131
132
132
# Usage Details
133
133
The source video can be any mkvtoolnix supported video format. The output is an MKV file with the same name and the same permissions. Owner is preserved if the script is executed as root.
@@ -157,15 +157,15 @@ Both audio **and** subtitle tracks that match the configured language(s) are kep
157
157
158
158
### Special Language Selections
159
159
The language selection **'Original'** will use the language Radarr pulled from [The Movie Database](https://www.themoviedb.org/ "TMDB") or that Sonarr pulled from [The TVDB](https://www.thetvdb.com/ "TVDB") during its last refresh.
160
-
Selecting this language is functionally equivalent to calling the script with `--audio :org --subs :org` command-line arguments. See [Original language code](./README.md#original-language-code) below for more details.
160
+
Selecting this language is functionally equivalent to calling the script with `--audio :org --subs :org` command-line arguments. See [Original language code](#original-language-code) below for more details.
161
161
162
162
The language selection **'Unknown'** will match tracks with **no configured language** in the video file. Selecting this language is functionally equivalent to calling the script with `--audio :und --subs :und` command-line arguments.
163
-
See [Unknown language code](./README.md#unknown-language-code) below for more details.
163
+
See [Unknown language code](#unknown-language-code) below for more details.
164
164
165
165
The language selection **'Any'** has two purposes:
166
166
1) In Radarr only, when set on a Quality Profile, it will trigger a search of languages in ***Custom Formats***
167
167
2) If languages are not configured in a Custom Format, or if you're using Sonarr, it will preserve **all languages** in the video file. This is functionally equivalent to calling the script with `--audio :any --subs :any` command-line arguments.
168
-
See [Any language code](./README.md#any-language-code) below for more details.
168
+
See [Any language code](#any-language-code) below for more details.
169
169
170
170
> [!IMPORTANT]
171
171
> When using *Custom Formats* language conditions and scoring you may not get the results you expect.
@@ -210,16 +210,17 @@ All language conditions with positive scores *and* Negated conditions with negat
210
210
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).
<summary>Table of Command-Line Arguments</summary>
217
217
218
218
Option|Argument|Description
219
219
---|---|---
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](./README.md#language-code-modifiers).
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
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.
222
-
`-f`, `--file`|`<video_file>`|If included, the script enters **[Batch Mode](./README.md#batch-mode)** and converts the specified video file.<br/>Requires the `-a` option.<br/>![notes] **Do not** use this argument when called from Radarr or Sonarr!
222
+
`--reorder`| |Reorder audio and subtitles tracks to match the language code order specified in the `<audio_languages>` and `<subtitle_languages>` arguments.<br/>This is skipped if no tracks are removed.
223
+
`-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!
223
224
`-l`, `--log`|`<log_file>`|The log filename<br/>Default is `/config/log/striptracks.txt`
224
225
`-c`, `--config`|`<config_file>`|Radarr/Sonarr XML configuration file<br/>Default is `/config/config.xml`
225
226
`-d`, `--debug`|`[<level>]`|Enables debug logging. Level is optional.<br/>Default is `1` (low)<br/>`2` includes JSON output<br/>`3` contains even more JSON output
@@ -228,7 +229,7 @@ Option|Argument|Description
228
229
229
230
</details>
230
231
231
-
The `<audio_languages>` and `<subtitle_languages>` are optional arguments that are colon (`:`) prepended language codes in [ISO 639-2](https://en.wikipedia.org/wiki/List_of_ISO_639-2_codes "List of ISO 639-2 codes") format.
232
+
The `<audio_languages>` and `<subtitle_languages>` arguments are colon (`:`) prepended language codes in [ISO 639-2](https://en.wikipedia.org/wiki/List_of_ISO_639-2_codes "List of ISO 639-2 codes") format.
232
233
For example:
233
234
234
235
* `:eng`
@@ -237,7 +238,7 @@ For example:
237
238
238
239
...etc.
239
240
240
-
Multiple codes may be concatenated, such as `:eng:spa` for both English and Spanish. Order is unimportant.
241
+
Multiple codes may be concatenated, such as `:eng:spa` for both English and Spanish. Order is unimportant, unless the `--reorder` option is also specified.
241
242
242
243
> [!WARNING]
243
244
> If no subtitle language is detected via Radarr/Sonarr configuration or specified on the command-line, all subtitles are removed.
@@ -268,7 +269,7 @@ The `:any` language code is a special code. When used, the script will preserve
268
269
### Original language code
269
270
The `:org` language code is a special code. When used, instead of retaining a specific language, the script substitutes the original movie or TV show language as specified in its [The Movie Database](https://www.themoviedb.org/ "TMDB") or [The TVDB](https://www.thetvdb.com/ "TVDB") entry.
270
271
As an example, when importing "*Amores Perros (2000)*" with options `--audio :org:eng`, the Spanish and English audio tracks are preserved.
271
-
Several [Included Wrapper Scripts](./README.md#included-wrapper-scripts) use this special code.
272
+
Several [Included Wrapper Scripts](#included-wrapper-scripts) use this special code.
272
273
273
274
> [!NOTE]
274
275
> This feature relies on the 'originalLanguage' field in the Radarr/Sonarr database. The `:org` code is therefore invalid when used in Batch Mode.
@@ -314,15 +315,15 @@ There is no way to force the script to remove audio tracks with these codes.
314
315
</details>
315
316
316
317
## Wrapper Scripts
317
-
To supply arguments to the script, you must either use one of the included wrapper scripts, create a custom wrapper script, or set the `STRIPTRACKS_ARGS` [environment variable](./README.md#environment-variable).
318
+
To supply arguments to the script, you must either use one of the included wrapper scripts, create a custom wrapper script, or set the `STRIPTRACKS_ARGS` [environment variable](#environment-variable).
318
319
319
320
> [!TIP]
320
321
> If you followed the Linuxserver.io recommendations when configuring your container, the `/config` directory will be mapped to an external storage location.
321
322
> 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 Radarr or Sonarr.
322
323
323
324
### Included Wrapper Scripts
324
325
For your convenience, several wrapper scripts are included in the `/usr/local/bin/` directory.
325
-
You may use any of these in place of `striptracks.sh` mentioned in the [Installation](./README.md#installation) section above.
326
+
You may use any of these in place of `striptracks.sh` mentioned in the [Installation](#installation) section above.
326
327
327
328
<details>
328
329
<summary>List of scripts</summary>
@@ -350,7 +351,7 @@ striptracks-org-spa.sh # Keep Original, Spanish, and Unknown audio, and Orig
350
351
<details>
351
352
<summary>Example Script</summary>
352
353
353
-
To configure an entry from the [Examples](./README.md#examples) section above, create and save a file called `striptracks-custom.sh` to `/config` containing the following text:
354
+
To configure an entry from the [Examples](#examples) section above, create and save a file called `striptracks-custom.sh` to `/config` containing the following text:
354
355
355
356
```shell
356
357
#!/bin/bash
@@ -364,7 +365,7 @@ Make it executable:
364
365
chmod +x /config/striptracks-custom.sh
365
366
```
366
367
367
-
Then put `/config/striptracks-custom.sh` in the **Path** field in place of `/usr/local/bin/striptracks.sh` mentioned in the [Installation](./README.md#installation) section above.
368
+
Then put `/config/striptracks-custom.sh` in the **Path** field in place of `/usr/local/bin/striptracks.sh` mentioned in the [Installation](#installation) section above.
368
369
369
370
</details>
370
371
@@ -410,7 +411,7 @@ The only events/notification triggers that are supported are **On Import** and *
410
411
## Batch Mode
411
412
Batch mode allows the script to be executed independently of Radarr or Sonarr. It converts the file specified on the command-line and ignores any environment variables that are normally expected to be set by the video management program.
412
413
413
-
Using this function, you can easily process all of your video files in any subdirectory at once. See the [Batch Example](./README.md#batch-example) below.
414
+
Using this function, you can easily process all of your video files in any subdirectory at once. See the [Batch Example](#batch-example) below.
414
415
415
416
### Script Execution Differences in Batch Mode
416
417
Because the script is not called from within Radarr or Sonarr, their database is unavailable to the script. Therefore, expect the following behavior while in Batch Mode:
@@ -460,7 +461,7 @@ However, configuring hardlinks is still recommended.
Hardlinks are essentially multiple references to the *same file*.
466
467
The purpose of a hardlink is to:
@@ -481,7 +482,7 @@ It is therefore still recommended to enable and use hardlinks in Radarr and Sona
481
482
482
483
# Uninstall
483
484
To completely remove the mod:
484
-
1. Delete the custom script from Radarr's or Sonarr's *Settings* > *Connect* screen that you created in the [Installation](./README.md#installation) section above.
485
+
1. Delete the custom script from Radarr's or Sonarr's *Settings* > *Connect* screen that you created in the [Installation](#installation) section above.
485
486
2. Stop and delete the Radarr/Sonarr container.
486
487
3. Remove the **DOCKER_MODS** environment variable from your `compose.yaml` file or exclude it from the `docker run` command when re-creating the Radarr/Sonarr container.
0 commit comments