mirror of
https://github.com/linuxserver/docker-mods.git
synced 2026-03-23 00:05:28 +08:00
Merge pull request #1011 from TheCaptain989/radarr-striptracks
radarr: striptracks release 2.13.0
This commit is contained in:
commit
40743247fc
BIN
.assets/radarr-enable-hardlinks.png
Normal file
BIN
.assets/radarr-enable-hardlinks.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 38 KiB |
2
.github/workflows/BuildImage.yml
vendored
2
.github/workflows/BuildImage.yml
vendored
@ -22,7 +22,7 @@ jobs:
|
||||
echo "MODNAME=${{ env.MODNAME }}" >> $GITHUB_OUTPUT
|
||||
echo "MULTI_ARCH=${{ env.MULTI_ARCH }}" >> $GITHUB_OUTPUT
|
||||
# **** If the mod needs to be versioned, set the versioning logic below. Otherwise leave as is. ****
|
||||
MOD_VERSION="2.9.0"
|
||||
MOD_VERSION="2.13.0"
|
||||
echo "MOD_VERSION=${MOD_VERSION}" >> $GITHUB_OUTPUT
|
||||
outputs:
|
||||
GITHUB_REPO: ${{ steps.outputs.outputs.GITHUB_REPO }}
|
||||
|
||||
243
README.md
243
README.md
@ -1,9 +1,11 @@
|
||||
# About
|
||||
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 [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.
|
||||
|
||||
**This unified script works in both Radarr and Sonarr. Use this mod in either container!**
|
||||
|
||||
>![notes] This mod supports Linux OSes only.
|
||||
> [!NOTE]
|
||||
> This mod supports Linux OSes only.
|
||||
|
||||
<!-- markdownlint-disable -->
|
||||
Production Container info: [](https://hub.docker.com/r/linuxserver/mods/tags?name=radarr-striptracks "Docker image size")
|
||||
[](https://github.com/linuxserver/docker-mods/pkgs/container/mods "GitHub package pulls")
|
||||
@ -64,7 +66,7 @@ Development Container info:
|
||||
<details>
|
||||
<summary>Synology Screenshot</summary>
|
||||
|
||||
*Example Synology Configuration*
|
||||
*Example Synology Configuration*
|
||||

|
||||
|
||||
</details>
|
||||
@ -77,15 +79,16 @@ Development Container info:
|
||||
<details>
|
||||
<summary>Screenshot</summary>
|
||||
|
||||
*Example Custom Script*
|
||||
*Example Custom Script*
|
||||

|
||||
|
||||
</details>
|
||||
|
||||
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.
|
||||
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.
|
||||
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.
|
||||
|
||||
>![notes] 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.
|
||||
> [!IMPORTANT]
|
||||
> 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.
|
||||
|
||||
## Radarr Configuration Example
|
||||
The following is a simplified example and steps to configure Radarr so the script will keep Original and English languages of an imported movie.
|
||||
@ -95,7 +98,7 @@ The following is a simplified example and steps to configure Radarr so the scrip
|
||||
<details>
|
||||
<summary>Screenshot</summary>
|
||||
|
||||
*New Custom Format Example*
|
||||
*New Custom Format Example*
|
||||

|
||||
|
||||
</details>
|
||||
@ -118,13 +121,13 @@ The following is a simplified example and steps to configure Radarr so the scrip
|
||||
<details>
|
||||
<summary>Screenshot</summary>
|
||||
|
||||
*Radarr Quality Profile Example*
|
||||
*Radarr Quality Profile Example*
|
||||

|
||||
|
||||
</details>
|
||||
|
||||
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.
|
||||
See [Automatic Language Detection](./README.md#automatic-language-detection) for more details.
|
||||
See [Automatic Language Detection](#automatic-language-detection) for more details.
|
||||
|
||||
# Usage Details
|
||||
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.
|
||||
@ -132,34 +135,43 @@ Chapters, if they exist, are preserved. The Title attribute in the MKV is set to
|
||||
(ex: `The Sting (1973)`) or the series title plus episode information (ex: `Happy! 01x01 - What Smiles Are For`).
|
||||
The language of the video file will be updated in the Radarr or Sonarr database to reflect the actual languages preserved in the remuxed video, and the video will be renamed according to the Radarr/Sonarr rules if needed (for example, if a removed track would trigger a name change.)
|
||||
|
||||
If you've configured the Radarr/Sonarr **Recycle Bin** path correctly, the original video will be moved there.
|
||||
>![warning] **WARNING:** If you have *not* configured the Recycle Bin, the original video file will be deleted/overwritten and permanently lost.
|
||||
|
||||
If the resulting video file would contain the same tracks as the original, and it's already an MKV, the remux step is skipped.
|
||||
|
||||
> [!TIP]
|
||||
> If you've configured the Radarr/Sonarr **Recycle Bin** path correctly, the original video will be moved there.
|
||||
|
||||
> [!CAUTION]
|
||||
> If you have ***not*** configured the Recycle Bin, the original video file will be deleted/overwritten and permanently lost.
|
||||
|
||||
## Automatic Language Detection
|
||||
Beginning with version 2.0 of this mod, the script may be called with no arguments. It will detect the language(s) configured within Radarr/Sonarr on the particular movie or TV show.
|
||||
Language selection(s) may be configured in ***Custom Formats*** (in Radarr v3 and higher and Sonarr v4 and higher), ***Quality Profiles*** (only in Radarr), or ***Language Profiles*** (Sonarr v3). Example screenshots are below.
|
||||
When the script is called with no arguments, it will attempt to detect the language(s) configured within Radarr/Sonarr on the particular movie or TV show.
|
||||
Language selection(s) may be configured in:
|
||||
- ***Custom Formats*** (in Radarr v3 and higher and Sonarr v4 and higher),
|
||||
- ***Quality Profiles*** (only in Radarr), or
|
||||
- ***Language Profiles*** (Sonarr v3)
|
||||
|
||||
Both audio **and** subtitle tracks that match the configured language(s) are kept.
|
||||
|
||||
> [!TIP]
|
||||
> It is **highly recommended** to review the [TraSH Guides](https://trash-guides.info/Radarr/Tips/How-to-setup-language-custom-formats/) setup instructions for Language Custom Formats.
|
||||
|
||||
### Special Language Selections
|
||||
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.
|
||||
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.
|
||||
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.
|
||||
|
||||
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.
|
||||
See [Unknown language code](./README.md#unknown-language-code) below for more details.
|
||||
See [Unknown language code](#unknown-language-code) below for more details.
|
||||
|
||||
The language selection **'Any'** has two purposes (Radarr only):
|
||||
1) It will trigger a search of languages in ***Custom Formats***
|
||||
2) If none are found, 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.
|
||||
See [Any language code](./README.md#any-language-code) below for more details.
|
||||
The language selection **'Any'** has two purposes:
|
||||
1) In Radarr only, when set on a Quality Profile, it will trigger a search of languages in ***Custom Formats***
|
||||
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.
|
||||
See [Any language code](#any-language-code) below for more details.
|
||||
|
||||
>![notes] When using *Custom Format* language conditions and scoring you may not get the results you expect.
|
||||
>This can be non-intuitive configuration, especially when using negative scoring, the 'Negate' option, and the 'Except Language' option.
|
||||
>The script does not care what custom format is *detected* by Radarr/Sonarr on the video file, only what the *scores* are in the *Quality Profile*.
|
||||
>If you choose to use Custom Formats, it is **highly recommended** to first run the script with the debug option `-d`, perform some test downloads and script runs, and then examine your results and the script logs closely to be sure things are working the way you want them to.
|
||||
|
||||
It is **highly recommended** to review the [TraSH Guides](https://trash-guides.info/Radarr/Tips/How-to-setup-language-custom-formats/) setup instructions for Language Custom Formats.
|
||||
> [!IMPORTANT]
|
||||
> When using *Custom Formats* language conditions and scoring you may not get the results you expect.
|
||||
> This can be non-intuitive configuration, especially when using negative scoring, the 'Negate' option, and the 'Except Language' option.
|
||||
> The script does not care what custom format is *applied* by Radarr/Sonarr on the video file, only what the custom format conditions are and the *scores* are in the corresponding *Quality Profile*.
|
||||
> If you choose to use Custom Formats, it is **highly recommended** to first run the script with the debug option `-d`, perform some test downloads and script runs, and then examine your results and the script logs closely to be sure things are working the way you want them to.
|
||||
|
||||
### Language Detection Precedence
|
||||
The following chart represents the order of precedence that the script uses to decide which language(s) to select when there are multiple settings configured. Moving left to right, it will stop when it finds a configured language.
|
||||
@ -167,25 +179,30 @@ The following chart represents the order of precedence that the script uses to d
|
||||
```mermaid
|
||||
graph LR
|
||||
A[Command-Line]
|
||||
B["Quality
|
||||
B["Environment
|
||||
Variable"]
|
||||
C["Quality
|
||||
Profile"]
|
||||
C["Custom
|
||||
D["Custom
|
||||
Formats"]
|
||||
D["Language Profile
|
||||
E["Language Profile
|
||||
(Sonarr only)"]
|
||||
A-->B
|
||||
B-- 'Any' -->C
|
||||
C-->D
|
||||
B-->C
|
||||
C-- 'Any' -->D
|
||||
D-->E
|
||||
```
|
||||
|
||||
Descriptively, these steps are:
|
||||
1. Command-line arguments (or environment variable) override all automatic language selection.
|
||||
2. If there are no command-line arguments, the video's *Quality Profile* is examined for a language configuration (only supported in Radarr).
|
||||
3. 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.
|
||||
1. Command-line arguments override all automatic language selection.
|
||||
2. Environment variable is checked for arguments.
|
||||
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).
|
||||
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.
|
||||
All language conditions with positive scores *and* Negated conditions with negative scores *and* non-Negated Except Language conditions with negative scores are selected.
|
||||
4. 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)
|
||||
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)
|
||||
|
||||
>![notes] For step 3 above, using *Custom Formats* when 'Any' is in the *Quality Profile* is consistent with the behavior described in [TRaSH Guides](https://trash-guides.info/Radarr/Tips/How-to-setup-language-custom-formats/ "TraSH Guides: How to setup Language Custom Formats").
|
||||
> [!NOTE]
|
||||
> For step 4 above, using *Custom Formats* when 'Any' is in the *Quality Profile* is consistent with the behavior described in [TRaSH Guides](https://trash-guides.info/Radarr/Tips/How-to-setup-language-custom-formats/ "TraSH Guides: How to setup Language Custom Formats").
|
||||
|
||||
## Command-Line Syntax
|
||||
|
||||
@ -193,25 +210,26 @@ All language conditions with positive scores *and* Negated conditions with negat
|
||||
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).
|
||||
|
||||
The syntax for the command-line is:
|
||||
`striptracks.sh [{-a|--audio} <audio_languages> [{-s|--subs} <subtitle_languages>] [{-f|--file} <video_file>]] [{-l,--log} <log_file>] [{-c,--config} <config_file>] [{-d|--debug} [<level>]]`
|
||||
`striptracks.sh [{-a|--audio} <audio_languages> [{-s|--subs} <subtitle_languages>] [--reorder] [{-f|--file} <video_file>]] [{-l|--log} <log_file>] [{-c|--config} <config_file>] [{-d|--debug} [<level>]]`
|
||||
|
||||
<details>
|
||||
<summary>Table of Command-Line Arguments</summary>
|
||||
|
||||
Option|Argument|Description
|
||||
---|---|---
|
||||
-a, --audio|<audio_languages>|Audio languages to keep<br/>ISO 639-2 code(s) prefixed with a colon (`:`)
|
||||
-s, --subs|<subtitle_languages>|Subtitle languages to keep<br/>ISO 639-2 code(s) prefixed with a colon (`:`)
|
||||
-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!
|
||||
-l, --log|\<log_file\>|The log filename<br/>Default is /config/log/striptracks.txt
|
||||
-c, --config|\<config_file\>|Radarr/Sonarr XML configuration file<br/>Default is /config/config.xml
|
||||
-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
|
||||
--help| |Display help and exit.
|
||||
--version| |Display version and exit.
|
||||
`-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).
|
||||
`-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.
|
||||
`--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.
|
||||
`-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!
|
||||
`-l`, `--log`|`<log_file>`|The log filename<br/>Default is `/config/log/striptracks.txt`
|
||||
`-c`, `--config`|`<config_file>`|Radarr/Sonarr XML configuration file<br/>Default is `/config/config.xml`
|
||||
`-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
|
||||
`--help`| |Display help and exit.
|
||||
`--version`| |Display version and exit.
|
||||
|
||||
</details>
|
||||
|
||||
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.
|
||||
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.
|
||||
For example:
|
||||
|
||||
* `:eng`
|
||||
@ -220,9 +238,30 @@ For example:
|
||||
|
||||
...etc.
|
||||
|
||||
Multiple codes may be concatenated, such as `:eng:spa` for both English and Spanish. Order is unimportant.
|
||||
Multiple codes may be concatenated, such as `:eng:spa` for both English and Spanish. Order is unimportant, unless the `--reorder` option is also specified.
|
||||
|
||||
>![warning] **WARNING:** If no subtitle language is detected via Radarr/Sonarr configuration or specified on the command-line, all subtitles are removed.
|
||||
> [!WARNING]
|
||||
> If no subtitle language is detected via Radarr/Sonarr configuration or specified on the command-line, all subtitles are removed.
|
||||
|
||||
### Language Code Modifiers
|
||||
Each language code can optionally be followed by a plus (`+`) and one or more modifier characters. Supported modifiers are:
|
||||
|
||||
Modifier|Function
|
||||
---|---
|
||||
`f`|Selects only tracks with the forced flag set
|
||||
`d`|Selects only tracks with the default flag set
|
||||
`[0-9]`|Specifies the maximum number of tracks to select.<br/>Based on the order of the tracks in the original source video.
|
||||
|
||||
These modifiers must be applied to each language code you want to modify. They may be used with either audio or subtitles codes.
|
||||
For example, the following options, `--audio :org:any+d --subs :eng+1:any+f` would keep:
|
||||
- All original language audio tracks, and all Default audio tracks regardless of language
|
||||
- One English language subtitles track, and all Forced subtitles tracks regardless of language
|
||||
|
||||
Modifiers may be combined, such as `:any+fd` to keep all forced and all default tracks, or `:eng+1d` to keep one default English track.
|
||||
|
||||
> [!NOTE]
|
||||
> Note the exact phrasing of the previous sentence. There is nuance here that is not obvious.
|
||||
> `:any+fd` is equivalent to `:any+f:any+d`, but `:eng+1d` is **not** the same as `:eng+1:eng+d`.
|
||||
|
||||
### Any language code
|
||||
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.
|
||||
@ -230,14 +269,16 @@ The `:any` language code is a special code. When used, the script will preserve
|
||||
### Original language code
|
||||
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.
|
||||
As an example, when importing "*Amores Perros (2000)*" with options `--audio :org:eng`, the Spanish and English audio tracks are preserved.
|
||||
Several [Included Wrapper Scripts](./README.md#included-wrapper-scripts) use this special code.
|
||||
Several [Included Wrapper Scripts](#included-wrapper-scripts) use this special code.
|
||||
|
||||
>![notes] This feature relies on the 'originalLanguage' field in the Radarr/Sonarr database. The `:org` code is therefore invalid when used in Batch Mode.
|
||||
> [!NOTE]
|
||||
> This feature relies on the 'originalLanguage' field in the Radarr/Sonarr database. The `:org` code is therefore invalid when used in Batch Mode.
|
||||
> The script will log a warning if it detects the use of `:org` in an invalid way, though it will continue to execute.
|
||||
|
||||
### Unknown language code
|
||||
The `:und` language code is a special code. When used, the script will match on any track that has a null or blank language attribute. If not included, tracks with no language attribute will be removed.
|
||||
>![warning] **WARNING:** It is common for M2TS and AVI files to have tracks with unknown languages! It is strongly recommended to include `:und` in most instances unless you know exactly what you're doing.
|
||||
> [!TIP]
|
||||
> It is common for M2TS and AVI files to have tracks with unknown languages! It is recommended to include `:und` in most instances unless you know exactly what you're doing.
|
||||
|
||||
## Special Handling of Audio
|
||||
The script is smart enough to not remove the last audio track. There is in fact no way to force the script to remove all audio. This way you don't have to specify every possible language if you are importing a foreign film, for example.
|
||||
@ -255,25 +296,34 @@ There is no way to force the script to remove audio tracks with these codes.
|
||||
-d 2 # Enable debugging level 2, audio and subtitles
|
||||
# languages detected from Radarr/Sonarr
|
||||
-a :eng:und -s :eng # Keep English and Unknown audio, and English subtitles
|
||||
-a :org:eng -s :eng # Keep English and Original audio, and English subtitles
|
||||
:eng "" # Keep English audio and remove all subtitles
|
||||
-d -a :eng:kor:jpn -s :eng:spa # Enable debugging level 1, keeping English, Korean, and Japanese audio, and
|
||||
# English and Spanish subtitles
|
||||
-a :org:eng -s :any+f:eng # Keep English and Original audio, and all forced or English subtitles
|
||||
-a :eng -s "" # Keep English audio and remove all subtitles
|
||||
-a :any -s "" # Keep all audio and remove all subtitles
|
||||
-d -a :eng:kor:jpn -s :eng:spa # Enable debugging level 1, keeping English, Korean, and Japanese audio,
|
||||
# and English and Spanish subtitles
|
||||
-f "/movies/Finding Nemo (2003).mkv" -a :eng:und -s :eng
|
||||
# Batch Mode
|
||||
# Keep English and Unknown audio and English subtitles, converting
|
||||
# video specified
|
||||
-a :any -s "" # Keep all audio and remove all subtitles
|
||||
--audio :org:any+d1 --subs :eng+1:any+f2
|
||||
# Keep Original audio and one default audio track regardless of language
|
||||
# (first audio track flagged as Default as it appears in the source file),
|
||||
# one English subtitles track and two forced subtitles regardless of
|
||||
# language (as they appear in the source file)
|
||||
```
|
||||
|
||||
</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 `STRIPTRACKS_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 `STRIPTRACKS_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 Radarr or Sonarr.
|
||||
|
||||
### Included Wrapper Scripts
|
||||
For your convenience, several wrapper scripts are included in the `/usr/local/bin/` directory.
|
||||
You may use any of these in place of `striptracks.sh` mentioned in the [Installation](./README.md#installation) section above.
|
||||
You may use any of these in place of `striptracks.sh` mentioned in the [Installation](#installation) section above.
|
||||
|
||||
<details>
|
||||
<summary>List of scripts</summary>
|
||||
@ -288,10 +338,9 @@ striptracks-eng-debug.sh # Keep English and Unknown audio, and English subtitl
|
||||
striptracks-eng-fre.sh # Keep English, French, and Unknown audio, and English and French subtitles
|
||||
striptracks-eng-jpn.sh # Keep English, Japanese, and Unknown audio and English subtitles
|
||||
striptracks-fre.sh # Keep French and Unknown audio, and French subtitles
|
||||
striptracks-fre-debug.sh # Keep French and Unknown audio, French subtitles, and enable debug logging
|
||||
striptracks-ger.sh # Keep German and Unknown audio, and German subtitles
|
||||
striptracks-spa.sh # Keep Spanish and Unknown audio, and Spanish subtitles
|
||||
striptracks-org-eng.sh # Keep Original, English, and Unknown audio, and Original and English subtitles
|
||||
striptracks-org-eng.sh # Keep Original, English, Unknown, and forced audio, and Original, English, and forced subtitles
|
||||
striptracks-org-ger.sh # Keep Original, German, and Unknown audio, and Original and German subtitles
|
||||
striptracks-org-spa.sh # Keep Original, Spanish, and Unknown audio, and Original and Spanish subtitles
|
||||
```
|
||||
@ -299,7 +348,10 @@ striptracks-org-spa.sh # Keep Original, Spanish, and Unknown audio, and Orig
|
||||
</details>
|
||||
|
||||
### Example Wrapper Script
|
||||
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:
|
||||
<details>
|
||||
<summary>Example Script</summary>
|
||||
|
||||
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:
|
||||
|
||||
```shell
|
||||
#!/bin/bash
|
||||
@ -313,12 +365,18 @@ Make it executable:
|
||||
chmod +x /config/striptracks-custom.sh
|
||||
```
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
>![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 Radarr or Sonarr.
|
||||
</details>
|
||||
|
||||
## Environment Variable
|
||||
The `striptracks.sh` script can read command-line arguments from the `STRIPTRACKS_ARGS` environment variable. This allows advanced use cases without having to provide a custom script.
|
||||
The script can also read arguments from the `STRIPTRACKS_ARGS` environment variable. This allows advanced use cases without having to provide a custom wrapper script.
|
||||
|
||||
> [!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.
|
||||
|
||||
<details>
|
||||
<summary>Example Docker Compose</summary>
|
||||
|
||||
For example, the following lines in your `compose.yml` file would keep English, Japanese, and Unknown audio and English subtitles:
|
||||
|
||||
@ -327,12 +385,18 @@ environment:
|
||||
- STRIPTRACKS_ARGS=--audio :eng:jpn:und --subs :eng
|
||||
```
|
||||
|
||||
</details>
|
||||
<details>
|
||||
<summary>Example Docker Run Command</summary>
|
||||
|
||||
In a `docker run` command, it would be:
|
||||
|
||||
```shell
|
||||
-e STRIPTRACKS_ARGS='--audio :eng:jpn:und --subs :eng'
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>Synology Screenshot</summary>
|
||||
|
||||
@ -341,15 +405,13 @@ In a `docker run` command, it would be:
|
||||
|
||||
</details>
|
||||
|
||||
>![notes] The environment variable is *only* read 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 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 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.
|
||||
|
||||
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.
|
||||
Using this function, you can easily process all of your video 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 Radarr or Sonarr, their database is unavailable to the script. Therefore, expect the following behavior while in Batch Mode:
|
||||
@ -361,18 +423,23 @@ Because the script is not called from within Radarr or Sonarr, their database is
|
||||
* *Original video files are deleted.*<br/>The Recycle Bin function is not available.
|
||||
|
||||
### Batch Example
|
||||
<details>
|
||||
<summary>Batch Mode Example</summary>
|
||||
|
||||
To keep English and Unknown audio and English subtitles on all video files ending in .MKV, .AVI, or .MP4 in the `/movies` directory, enter the following at the Linux command-line:
|
||||
|
||||
```shell
|
||||
find /movies/ -type f \( -name "*.mkv" -o -name "*.avi" -o -name "*.mp4" \) | while read file; do /usr/local/bin/striptracks.sh -f "$file" -a :eng:und -s :eng; done
|
||||
```
|
||||
|
||||
Here's another example to keep English, Danish, and Unknown languages on all video files in your `./videos` directory (requires the `file` program; testable with `file -v`):
|
||||
Here's another example to keep English, Danish, Unknown languages, and all forced subtitles on all video files in your `./videos` directory (requires the `file` program; testable with `file -v`):
|
||||
|
||||
```shell
|
||||
find ./videos/ -type f | while read filename; do if file -i "$filename" | grep -q video; then /usr/local/bin/striptracks.sh -f "$filename" --audio :eng:dan:und --subs :eng:dan:und; fi; done
|
||||
find ./videos/ -type f | while read filename; do if file -i "$filename" | grep -q video; then /usr/local/bin/striptracks.sh -f "$filename" --audio :eng:dan:und --subs :eng:dan:und:any+f; fi; done
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
## Logs
|
||||
By default, a log file is created for the script activity called:
|
||||
|
||||
@ -383,11 +450,39 @@ This log can be inspected or downloaded from Radarr/Sonarr under *System* > *Log
|
||||
Script errors will show up in both the script log and the native Radarr/Sonarr log.
|
||||
|
||||
Log rotation is performed with 5 log files of 512KB each being kept.
|
||||
>![warning] **WARNING:** If debug logging is enabled with a level above 1, the log file can grow very large very quickly. *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. *Do not leave high-level debug logging enabled permanently.*
|
||||
|
||||
# Limitations
|
||||
It should be noted that this script's core functionality nulifies some of the benefits of [hardlinks](https://trash-guides.info/hardlinks/).
|
||||
However, configuring hardlinks is still recommended.
|
||||
|
||||
<details>
|
||||
<summary>Hardlink Limitations</summary>
|
||||
|
||||
*Radarr Hardlinks Configuration Screenshot*
|
||||

|
||||
|
||||
Hardlinks are essentially multiple references to the *same file*.
|
||||
The purpose of a hardlink is to:
|
||||
- Allow instant file moves from the download client to Radarr or Sonarr
|
||||
- Reduce duplicate storage space
|
||||
- Allow torrent seeding after download
|
||||
|
||||
Because the script creates a brand-new video file that includes only the selected streams and deletes the original, a hardlink cannot be preserved.
|
||||
Instant file moves from your download client will continue to work, but the new file will consume additional space, and the original file will be deleted (or unlinked) by
|
||||
the script which could prevent torrent seeding.
|
||||
|
||||
The script will log a warning if it detects the input video is a hardlink.
|
||||
|
||||
Note that the script does not *always* create a new file. If there are no streams removed, the original video file is not deleted and any hardlinks are preserved.
|
||||
It is therefore still recommended to enable and use hardlinks in Radarr and Sonarr.
|
||||
|
||||
</details>
|
||||
|
||||
# Uninstall
|
||||
To completely remove the mod:
|
||||
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.
|
||||
1. Delete the custom script from Radarr's or Sonarr's *Settings* > *Connect* screen that you created in the [Installation](#installation) section above.
|
||||
2. Stop and delete the Radarr/Sonarr container.
|
||||
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.
|
||||
|
||||
@ -403,11 +498,11 @@ This would not be possible without the following:
|
||||
[LinuxServer.io Sonarr](https://hub.docker.com/r/linuxserver/sonarr "Sonarr Docker container") container
|
||||
[LinuxServer.io Docker Mods](https://hub.docker.com/r/linuxserver/mods "Docker Mods containers") project
|
||||
[MKVToolNix](https://mkvtoolnix.download/ "MKVToolNix homepage") by Moritz Bunkus
|
||||
The AWK script parsing mkvmerge output is adapted from Endoro's post on [VideoHelp](https://forum.videohelp.com/threads/343271-BULK-remove-non-English-tracks-from-MKV-container#post2292889).
|
||||
Inspired by Endoro's post on [VideoHelp](https://forum.videohelp.com/threads/343271-BULK-remove-non-English-tracks-from-MKV-container#post2292889).
|
||||
Icons made by [Freepik](https://www.freepik.com) from [Flaticon](https://www.flaticon.com/)
|
||||
|
||||
## Legacy Change Notes
|
||||
Beginning with version 2.0 of this mod, it only supports v3 or later of Radarr/Sonarr. For legacy Radarr/Sonarr v2 please use mod release 1.3 or earlier.
|
||||
Beginning with version 2.0 of this mod, it only supports v3 or later of Radarr/Sonarr. For legacy Radarr/Sonarr v2 please use mod release 1.3 or earlier.
|
||||
Version 2.0 of this mod introduced automatic language detection.
|
||||
|
||||
[warning]: .assets/warning.png "Warning"
|
||||
[notes]: .assets/notes.png "Note"
|
||||
|
||||
@ -6,8 +6,8 @@ Only the latest major and minor version are supported.
|
||||
|
||||
| Version | Supported |
|
||||
| ------- | ------------------ |
|
||||
| 2.9.x | :heavy_check_mark: |
|
||||
| < 2.9 | :x: |
|
||||
| 2.13.x | :heavy_check_mark: |
|
||||
| < 2.13 | :x: |
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
. /usr/local/bin/striptracks.sh :nld:dut:und :nld:dut
|
||||
. /usr/local/bin/striptracks.sh --audio :nld:dut:und --subs :nld:dut
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
. /usr/local/bin/striptracks.sh -d :eng:und :eng
|
||||
. /usr/local/bin/striptracks.sh -d --audio :eng:und:any+d --subs :eng:any+f
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
. /usr/local/bin/striptracks.sh :eng:fre:und :eng:fre
|
||||
. /usr/local/bin/striptracks.sh --audio :eng:fre:und --subs :eng:fre
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
. /usr/local/bin/striptracks.sh :eng:jpn:und :eng
|
||||
. /usr/local/bin/striptracks.sh --audio :eng:jpn:und --subs :eng
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
. /usr/local/bin/striptracks.sh :eng:und :eng
|
||||
. /usr/local/bin/striptracks.sh --audio :eng:und --subs :eng
|
||||
|
||||
@ -1,3 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
. /usr/local/bin/striptracks.sh -d :fre:fra:und :fre:fra
|
||||
@ -1,3 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
. /usr/local/bin/striptracks.sh :fre:fra:und :fre:fra
|
||||
. /usr/local/bin/striptracks.sh --audio :fre:fra:und --subs :fre:fra
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
. /usr/local/bin/striptracks.sh :ger:deu:und :ger:deu
|
||||
. /usr/local/bin/striptracks.sh --audio :ger:deu:und --subs :ger:deu
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
. /usr/local/bin/striptracks.sh --audio :org:eng:und --subs :org:eng
|
||||
. /usr/local/bin/striptracks.sh --audio :org:eng:und:any+d --subs :org:eng:any+f
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
. /usr/local/bin/striptracks.sh :spa:und :spa
|
||||
. /usr/local/bin/striptracks.sh --audio :spa:und --subs :spa
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user