mirror of
https://github.com/TrezOne/docker-mods-uptime-kuma-timeout-fix.git
synced 2026-06-26 10:12:46 -04:00
Merge pull request #277 from TheCaptain989/radarr-striptracks
radarr: striptracks Release 2.2
This commit is contained in:
@@ -51,18 +51,19 @@ Production Container info: 
|
||||
|
||||
The script will detect the language defined in the video profile for the movie or TV show and only keep the audio and subtitles selected.
|
||||
Alternatively, a wrapper script may be used to more granularly define which tracks to keep. See [wrapper scripts](./README.md#wrapper-scripts) for more details.
|
||||
Alternatively, a wrapper script may be used to more granularly define which tracks to keep. See [Wrapper Scripts](./README.md#wrapper-scripts) for more details.
|
||||
|
||||
## Usage
|
||||
The source video can be any mkvtoolnix supported video format. The output is an MKV file with the same name.
|
||||
Chapters, if they exist, are preserved. The Title attribute in the MKV is set to the movie title plus year
|
||||
(ex: `The Sting (1973)`) or the series title plus episode information (ex: `Happy! 01x01 - What Smiles Are For`).
|
||||
(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.
|
||||
|
||||
If you've configured the Radarr/Sonarr **Recycle Bin** path correctly, the original video will be moved there.
|
||||
![danger] **NOTE:** If you have *not* configured the Recycle Bin, the original video file will be deleted/overwritten and permanently lost.
|
||||
|
||||
### Syntax
|
||||
Beginning with version 2.0 of this mod, the script may be called with no arguments. In this configuration it will detect the language(s) defined in the profile (Quality Profile for Radarr, Language Profile for Sonarr) configured on the particular movie or TV show.
|
||||
Beginning with version 2.0 of this mod, the script may be called with no arguments. In this configuration it will detect the language(s) defined in the profile (*Quality Profile* for Radarr, *Language Profile* for Sonarr) configured on the particular movie or TV show.
|
||||
|
||||
#### Automatic Language Detection
|
||||
Both audio and subtitles that match the selected language(s) are kept.
|
||||
@@ -75,35 +76,49 @@ Both audio and subtitles that match the selected language(s) are kept.
|
||||
|
||||
>**Note:** The intent of the Radarr language selection 'Original' is not well documented. For the purposes of this script, it has the same function as 'Any' and will preserve all languages in the video file.
|
||||
|
||||
#### Manual Override
|
||||
The script still supports command line arguments that can override what is detected. More granular control can be therefore be exerted or extended using tagging and defining multiple Connect scripts (this is outside the scope of this documentation).
|
||||
#### Command Line Options and Arguments
|
||||
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 script accepts two command line arguments and one option:
|
||||
The syntax for the command line is:
|
||||
`striptracks.sh [OPTIONS] [<audio_languages> [<subtitle_languages>]]` OR
|
||||
`striptracks.sh [OPTIONS] {-f|--file} <video_file> {-a|--audio} <audio_languages> {-s|--subs} <subtitle_languages>`
|
||||
|
||||
`[-d] [<audio_languages> [<subtitle_languages>]]`
|
||||
Where:
|
||||
|
||||
The `<audio_languages>` and `<subtitle_languages>` are optional arguments that are colon (:) prepended language codes in [ISO639-2](https://en.wikipedia.org/wiki/List_of_ISO_639-2_codes "List of ISO 639-2 codes") format.
|
||||
Option|Argument|Description
|
||||
---|---|---
|
||||
-d, --debug|\[\<level\>\]|Enables debug logging. Level is optional.<br/>Default of 1 (low)<br/>2 includes JSON output<br/>3 contains even more JSON output
|
||||
-a, --audio|<audio_languages>|Audio languages to keep<br/>ISO639-2 code(s) prefixed with a colon (`:`)
|
||||
-s, --subs|<subtitle_languages>|Subtitle languages to keep<br/>IISO639-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/>![danger] **WARNING:** Do not use this argument when called from Radarr or Sonarr!
|
||||
--help| |Display help and exit
|
||||
|
||||
The `<audio_languages>` and `<subtitle_languages>` are optional arguments that are colon (`:`) prepended language codes in [ISO639-2](https://en.wikipedia.org/wiki/List_of_ISO_639-2_codes "List of ISO 639-2 codes") format.
|
||||
For example:
|
||||
|
||||
* :eng
|
||||
* :fre
|
||||
* :spa
|
||||
* `:eng`
|
||||
* `:fre`
|
||||
* `:spa`
|
||||
|
||||
...etc.
|
||||
|
||||
Multiple codes may be concatenated, such as `:eng:spa` for both English and Spanish.
|
||||
Multiple codes may be concatenated, such as `:eng:spa` for both English and Spanish.
|
||||
|
||||
>**NOTE:** The script is smart enough to not remove the last audio track. This way you don't have to specify every possible language if you are importing a
|
||||
foreign film, for example.
|
||||
|
||||
The `-d` option enables debug logging.
|
||||
|
||||
### Examples
|
||||
```
|
||||
:eng:und :eng # keep English and Undetermined audio and English subtitles
|
||||
-d :eng "" # Enable debugging, keeping English audio and no subtitles
|
||||
:eng:kor:jpn :eng:spa # Keep English, Korean, and Japanese audio, and English and
|
||||
# Spanish subtitles
|
||||
-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
|
||||
:eng "" # Keep English audio and no subtitles
|
||||
-d :eng:kor:jpn :eng:spa # Enable debugging level 1, keeping English, Korean, and Japanese audio, and English and
|
||||
# Spanish subtitles
|
||||
-f \"/path/to/movies/Finding Nemo (2003).mkv\" -a :eng:und -s :eng
|
||||
# Batch Mode
|
||||
# Keep English and Unknown audio and
|
||||
# English subtitles, converting video specified
|
||||
```
|
||||
|
||||
### Wrapper Scripts
|
||||
@@ -115,11 +130,13 @@ You may use any of these scripts in place of `striptracks.sh` mentioned in the [
|
||||
|
||||
```
|
||||
striptracks-debug.sh # Use detected languages, but enable debug logging
|
||||
striptracks-debug-2.sh # Use detected languages, enable debug logging level 2
|
||||
striptracks-debug-max.sh # Use detected languages, enable highest debug logging
|
||||
striptracks-dut.sh # Keep Dutch audio and subtitles
|
||||
striptracks-eng.sh # Keep English and Undetermined audio and English subtitles
|
||||
striptracks-eng-debug.sh # Keep English and Undetermined audio and English subtitles, and enable debug logging
|
||||
striptracks-eng-fre.sh # Keep English, French, and Undetermined audio and English subtitles
|
||||
striptracks-eng-jpn.sh # Keep English, Japanese, and Undetermined audio and English subtitles
|
||||
striptracks-eng.sh # Keep English and Unknown audio and English subtitles
|
||||
striptracks-eng-debug.sh # Keep English and Unknown audio and English subtitles, and enable debug logging
|
||||
striptracks-eng-fre.sh # Keep English, French, and Unknown audio and English subtitles
|
||||
striptracks-eng-jpn.sh # Keep English, Japanese, and Unknown audio and English subtitles
|
||||
striptracks-fre.sh # Keep French audio and subtitles
|
||||
striptracks-fre-debug.sh # Keep French audio and subtitles, and enable debug logging
|
||||
striptracks-ger.sh # Keep German audio and subtitles
|
||||
@@ -127,11 +144,11 @@ striptracks-spa.sh # Keep Spanish audio and subtitles
|
||||
```
|
||||
|
||||
#### Example Wrapper Script
|
||||
To configure the last entry from the [Examples](./README.md#examples) section above, create and save a file called `striptracks-custom.sh` to `/config` containing the following text:
|
||||
To configure the 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:
|
||||
```shell
|
||||
#!/bin/bash
|
||||
|
||||
. /usr/local/bin/striptracks.sh :eng:kor:jpn :eng:spa
|
||||
. /usr/local/bin/striptracks.sh -d :eng:kor:jpn :eng:spa
|
||||
```
|
||||
Make it executable:
|
||||
```shell
|
||||
@@ -145,6 +162,25 @@ Then put `/config/striptracks-custom.sh` in the **Path** field in place of `/usr
|
||||
### Triggers
|
||||
The only events/notification triggers that have been tested are **On Import** and **On Upgrade**
|
||||
|
||||
### 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.
|
||||
|
||||
#### Script Execution Differences in Batch Mode
|
||||
Because the script is not called from within Radarr or Sonarr, expect the following behavior while in Batch Mode:
|
||||
* *The file name must be specified on the command line*<br/>(The `-f` flag places the script in Batch Mode)
|
||||
* *No audio or subtitles language auto detection occurs.*<br/>Both the audio and subtitles languages must be specified on the command line
|
||||
* *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.
|
||||
* *Radarr or Sonarr APIs are not called and their database is not updated.*<br/>This may require a manual rescan of converted videos.
|
||||
* *Original video files are deleted.*<br/>The Recycle Bin function is not available.
|
||||
|
||||
#### Batch Example
|
||||
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
|
||||
```
|
||||
|
||||
### Logs
|
||||
A log file is created for the script activity called:
|
||||
|
||||
@@ -155,7 +191,7 @@ 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.
|
||||
>![danger] **NOTE:** If debug logging is enabled, the log file can grow very large very quickly. *Do not leave debug logging enabled permanently.*
|
||||
>![danger] **NOTE:** 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.*
|
||||
|
||||
___
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@ EOF
|
||||
# Determine if setup is needed
|
||||
if [ ! -f /usr/bin/mkvmerge ]; then
|
||||
echo "Running first time setup."
|
||||
|
||||
if [ -f /usr/bin/apt ]; then
|
||||
# Ubuntu
|
||||
echo "Installing MKVToolNix using apt-get"
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
. /usr/local/bin/striptracks.sh -d 2
|
||||
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
. /usr/local/bin/striptracks.sh -d 9
|
||||
+498
-193
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user