Release 2.3.2

- Fixed missing executable attribute on some script files
- Fixed null subtitle option to remove all subtitles (resolves linuxserver/docker-mods#537)
- Named arguments now override positional arguments
- Updated cmd line help
- Updated README
This commit is contained in:
TheCaptain989
2023-01-15 11:25:30 -06:00
parent 6d98580a57
commit 5b20d34e2e
3 changed files with 45 additions and 35 deletions
+7 -6
View File
@@ -84,9 +84,7 @@ Both audio and subtitles that match the selected language(s) are kept.
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 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: The syntax for the command line is:
`striptracks.sh [OPTIONS] [<audio_languages> [<subtitle_languages>]]` `striptracks.sh [{-d|--debug} [<level>]] [[{-f|--file} <video_file>] {-a|--audio} <audio_languages> [{-s|--subs} <subtitle_languages>]]`
OR
`striptracks.sh [OPTIONS] {-f|--file} <video_file> {-a|--audio} <audio_languages> {-s|--subs} <subtitle_languages>`
Where: Where:
@@ -95,8 +93,9 @@ 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 -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 (`:`) -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 (`:`) -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! -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/>![danger] **WARNING:** Do not use this argument when called from Radarr or Sonarr!
--help| |Display help and exit --help| |Display help and exit.
--version| |Display version 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. 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: For example:
@@ -112,6 +111,8 @@ Multiple codes may be concatenated, such as `:eng:spa` for both English and Span
>**NOTE:** 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 >**NOTE:** 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. foreign film, for example.
>![warning] **NOTE:** If no subtitle language is detected in the profile or specified on the command line, all subtitles are removed.
#### Original language code #### 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 language as specified in its [The Movie Database](https://www.themoviedb.org/ "TMDB") entry. The `:org` language code is a special code. When used, instead of retaining a specific language, the script substitutes the original movie language as specified in its [The Movie Database](https://www.themoviedb.org/ "TMDB") entry.
As an example, when importing "_Amores Perros (2000)_" with options `--audio :org:eng`, the Spanish and English audio tracks are preserved. As an example, when importing "_Amores Perros (2000)_" with options `--audio :org:eng`, the Spanish and English audio tracks are preserved.
@@ -129,7 +130,7 @@ The `:und` language code is a special code. When used, the script will match on
# languages detected from Radarr/Sonarr # languages detected from Radarr/Sonarr
-a :eng:und -s :eng # Keep English and Unknown audio, and English subtitles -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 -a :org:eng -s :eng # Keep English and Original audio, and English subtitles
:eng "" # Keep English audio and no subtitles :eng "" # Keep English audio and remove all subtitles
-d :eng:kor:jpn :eng:spa # Enable debugging level 1, keeping English, Korean, and Japanese audio, and -d :eng:kor:jpn :eng:spa # Enable debugging level 1, keeping English, Korean, and Japanese audio, and
# English and Spanish subtitles # English and Spanish subtitles
-f "/path/to/movies/Finding Nemo (2003).mkv" -a :eng:und -s :eng -f "/path/to/movies/Finding Nemo (2003).mkv" -a :eng:und -s :eng
+2 -1
View File
@@ -6,7 +6,8 @@ Only the latest major and minor version are supported.
| Version | Supported | | Version | Supported |
| ------- | ------------------ | | ------- | ------------------ |
| 2.x | :heavy_check_mark: | | 2.3.x | :heavy_check_mark: |
| < 2.3 | :x: |
## Reporting a Vulnerability ## Reporting a Vulnerability
+36 -28
View File
@@ -58,13 +58,13 @@ function usage {
usage=" usage="
$striptracks_script Version: $striptracks_ver $striptracks_script Version: $striptracks_ver
Video remuxing script that only keeps tracks with the specified languages. Video remuxing script that only keeps tracks with the specified languages.
Designed for use with Radarr and Sonarr, but may be used standalone in batch mode. Designed for use with Radarr and Sonarr, but may be used standalone in batch
mode.
Source: https://github.com/TheCaptain989/radarr-striptracks Source: https://github.com/TheCaptain989/radarr-striptracks
Usage: Usage:
$0 [OPTIONS] [<audio_languages> [<subtitle_languages>]] $0 [{-d|--debug} [<level>]] [[{-f|--file} <video_file>] {-a|--audio} <audio_languages> [{-s|--subs} <subtitle_languages>]]
$0 [OPTIONS] {-f|--file} <video_file> {-a|--audio} <audio_languages> {-s|--subs} <subtitle_languages>
Options and Arguments: Options and Arguments:
-d, --debug [<level>] enable debug logging -d, --debug [<level>] enable debug logging
@@ -82,10 +82,10 @@ Options and Arguments:
--help display this help and exit --help display this help and exit
--version display script version and exit --version display script version and exit
When audio_languages and subtitle_languages are omitted the script detects the audio When audio_languages and subtitle_languages are omitted the script detects the
or subtitle languages configured in the Radarr or Sonarr profile. When used on the command audio or subtitle languages configured in the Radarr or Sonarr profile. When
line, they override the detected codes. They are also accepted as positional parameters used on the command line, they override the detected codes. They are also
for backwards compatibility. accepted as positional parameters for backwards compatibility.
Batch Mode: Batch Mode:
In batch mode the script acts as if it were not called from within Radarr In batch mode the script acts as if it were not called from within Radarr
@@ -94,21 +94,23 @@ Batch Mode:
attribute is set to the basename of the file minus the extension. attribute is set to the basename of the file minus the extension.
Examples: Examples:
$striptracks_script -d 2 # Enable debugging level 2, audio and subtitles $striptracks_script -d 2 # Enable debugging level 2, audio and
# languages detected from Radarr/Sonarr # subtitles languages detected from
$striptracks_script -a :eng:und -s :eng # keep English and Unknown audio and # Radarr/Sonarr
# English subtitles $striptracks_script -a :eng:und -s :eng # keep English and Unknown audio and
$striptracks_script -a :eng:org -s :eng # keep English and Original audio and # English subtitles
# English subtitles $striptracks_script -a :eng:org -s :eng # keep English and Original audio and
$striptracks_script :eng \"\" # keep English audio and no subtitles # English subtitles
$striptracks_script -d :eng:kor:jpn :eng:spa # Enable debugging level 1, keeping English, Korean, $striptracks_script :eng \"\" # keep English audio and no subtitles
# and Japanese audio, and English and $striptracks_script -d :eng:kor:jpn :eng:spa # Enable debugging level 1, keeping
# Spanish subtitles # English, Korean, and Japanese
$striptracks_script -f \"/path/to/movies/Finding Nemo (2003).mkv\" -a :eng:und -s :eng # audio, and English and Spanish
# Batch Mode # subtitles
# Keep English and Unknown audio and $striptracks_script -f \"/movies/path/Finding Nemo (2003).mkv\" -a :eng:und -s :eng
# English subtitles, converting video specified # Batch Mode
# Keep English and Unknown audio and
# English subtitles, converting video
# specified
" "
echo "$usage" >&2 echo "$usage" >&2
} }
@@ -181,10 +183,18 @@ eval set -- "$striptracks_pos_params"
# Check for and assign positional arguments # Check for and assign positional arguments
if [ -n "$1" ]; then if [ -n "$1" ]; then
striptracks_audiokeep="$1" if [ -n "$striptracks_audiokeep" ]; then
echo "Warning|Both positional and named arguments set for audio. Using $striptracks_audiokeep" >&2
else
striptracks_audiokeep="$1"
fi
fi fi
if [ -n "$2" ]; then if [ -n "$2" ]; then
striptracks_subskeep="$2" if [ -n "$striptracks_subskeep" ]; then
echo "Warning|Both positional and named arguments set for subtitles. Using $striptracks_subskeep" >&2
else
striptracks_subskeep="$2"
fi
fi fi
## Mode specific variables ## Mode specific variables
@@ -606,11 +616,9 @@ if [ -n "$striptracks_subskeep" ]; then
elif [ -n "$striptracks_proflangCodes" ]; then elif [ -n "$striptracks_proflangCodes" ]; then
striptracks_subskeep="$striptracks_proflangCodes" striptracks_subskeep="$striptracks_proflangCodes"
else else
striptracks_message="Error|No subtitles languages specified or detected!" striptracks_message="Info|No subtitles languages specified or detected. Removing all subtitles found."
echo "$striptracks_message" | log echo "$striptracks_message" | log
echo "$striptracks_message" >&2 striptracks_subskeep="null"
usage
exit 3
fi fi
#### BEGIN MAIN #### BEGIN MAIN