From 53bec57fb1f2df0e32b3e905788f04ee2aadb739 Mon Sep 17 00:00:00 2001 From: TheCaptain989 Date: Wed, 16 Apr 2025 18:52:51 +0000 Subject: [PATCH 1/4] Release 2.13.1 --- .github/workflows/BuildImage.yml | 21 ++++++-- README.md | 35 ++++++++++++- root/usr/local/bin/striptracks.sh | 87 ++++++++++++++++++------------- 3 files changed, 102 insertions(+), 41 deletions(-) mode change 100755 => 100644 root/usr/local/bin/striptracks.sh diff --git a/.github/workflows/BuildImage.yml b/.github/workflows/BuildImage.yml index 79a5cf1b..82e84c16 100644 --- a/.github/workflows/BuildImage.yml +++ b/.github/workflows/BuildImage.yml @@ -1,12 +1,20 @@ name: Build Image -on: [push, pull_request_target, workflow_dispatch] +on: + push: + pull_request_target: + workflow_dispatch: + inputs: + mod_version: + type: string + required: false env: GITHUB_REPO: "linuxserver/docker-mods" #don't modify ENDPOINT: "linuxserver/mods" #don't modify BASEIMAGE: "radarr" #replace MODNAME: "striptracks" #replace + MOD_VERSION: ${{ inputs.mod_version }} #don't modify MULTI_ARCH: "false" #set to true if needed jobs: @@ -21,8 +29,13 @@ jobs: echo "BASEIMAGE=${{ env.BASEIMAGE }}" >> $GITHUB_OUTPUT 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.13.0" + if [[ -z "${{ env.MOD_VERSION }}" ]]; then + # **** If the mod needs to be versioned, set the versioning logic below. Otherwise leave as is. **** + MOD_VERSION="2.13.1" + else + MOD_VERSION=${{ env.MOD_VERSION }} + echo "MOD_VERSION_OVERRIDE=true" >> $GITHUB_OUTPUT + fi echo "MOD_VERSION=${MOD_VERSION}" >> $GITHUB_OUTPUT outputs: GITHUB_REPO: ${{ steps.outputs.outputs.GITHUB_REPO }} @@ -31,6 +44,7 @@ jobs: MODNAME: ${{ steps.outputs.outputs.MODNAME }} MULTI_ARCH: ${{ steps.outputs.outputs.MULTI_ARCH }} MOD_VERSION: ${{ steps.outputs.outputs.MOD_VERSION }} + MOD_VERSION_OVERRIDE: ${{ steps.outputs.outputs.MOD_VERSION_OVERRIDE }} build: uses: linuxserver/github-workflows/.github/workflows/docker-mod-builder.yml@v1 @@ -47,3 +61,4 @@ jobs: MODNAME: ${{ needs.set-vars.outputs.MODNAME }} MULTI_ARCH: ${{ needs.set-vars.outputs.MULTI_ARCH }} MOD_VERSION: ${{ needs.set-vars.outputs.MOD_VERSION }} + MOD_VERSION_OVERRIDE: ${{ needs.set-vars.outputs.MOD_VERSION_OVERRIDE }} diff --git a/README.md b/README.md index 4003d329..43600bdb 100644 --- a/README.md +++ b/README.md @@ -219,7 +219,7 @@ Option|Argument|Description ---|---|--- `-a`, `--audio`|``|Audio languages to keep
ISO 639-2 code(s) prefixed with a colon (`:`)
Each code may optionally be followed by a plus (`+`) and one or more [modifiers](#language-code-modifiers). `-s`, `--subs`|``|Subtitle languages to keep
ISO 639-2 code(s) prefixed with a colon (`:`)
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 `` and `` arguments.
This is skipped if no tracks are removed. +`--reorder`| |Reorder audio and subtitles tracks to match the language code order specified in the `` and `` arguments. `-f`, `--file`|``|If included, the script enters **[Batch Mode](#batch-mode)** and converts the specified video file.
Requires the `--audio` option.
![notes] **Do not** use this argument when called from Radarr or Sonarr! `-l`, `--log`|``|The log filename
Default is `/config/log/striptracks.txt` `-c`, `--config`|``|Radarr/Sonarr XML configuration file
Default is `/config/config.xml` @@ -238,7 +238,7 @@ For example: ...etc. -Multiple codes may be concatenated, such as `:eng:spa` for both English and Spanish. Order is unimportant, unless the `--reorder` option is also specified. +Multiple codes may be concatenated, such as `:eng:spa` for both English and Spanish. Order is unimportant, unless the `--reorder` option is specified. > [!WARNING] > If no subtitle language is detected via Radarr/Sonarr configuration or specified on the command-line, all subtitles are removed. @@ -280,6 +280,37 @@ The `:und` language code is a special code. When used, the script will match on > [!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. +### Reorder Option +The `--reorder` option uses the order the language codes are specified to re-order the tracks in the output MKV video file. Video tracks are always first, followed by audio tracks, and then subtitles. Track removals and preservations occur the way they normally would. + +
+Reorder Example + +For example, given a source video (w/original language of English) that has the following track order: + +> Track ID:0 Type:video Name:null Lang:und Codec:AVC/H.264/MPEG-4p10 Default:true Forced:false +> Track ID:1 Type:audio Name:French Lang:fre Codec:E-AC-3 Default:true Forced:false +> Track ID:2 Type:audio Name:German Lang:deu Codec:AC-3 Default:false Forced:false +> Track ID:3 Type:audio Name:English Lang:eng Codec:AC-3 Default:false Forced:false +> Track ID:4 Type:subtitles Name:French Lang:fre Codec:SubRip/SRT Default:false Forced:false +> Track ID:5 Type:subtitles Name:English Lang:eng Codec:SubRip/SRT Default:false Forced:false + +And using the command line: + +```shell +/usr/local/bin/striptracks.sh --audio :org+1:eng+1:fre+1:und+1 --subs :eng+1:fre+1:spa+1 --reorder +``` + +Will create an MKV file with tracks: + +> Track ID:0 Type:video Name:null Lang:und Codec:AVC/H.264/MPEG-4p10 Default:true Forced:false +> Track ID:1 Type:audio Name:English Lang:eng Codec:AC-3 Default:false Forced:false +> Track ID:2 Type:audio Name:French Lang:fre Codec:E-AC-3 Default:true Forced:false +> Track ID:3 Type:subtitles Name:English Lang:eng Codec:SubRip/SRT Default:false Forced:false +> Track ID:4 Type:subtitles Name:French Lang:fre Codec:SubRip/SRT Default:false Forced:false + +
+ ## 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. diff --git a/root/usr/local/bin/striptracks.sh b/root/usr/local/bin/striptracks.sh old mode 100755 new mode 100644 index 20903174..1217414a --- a/root/usr/local/bin/striptracks.sh +++ b/root/usr/local/bin/striptracks.sh @@ -96,8 +96,6 @@ Options and Arguments: the language code order specified in the and arguments. - Track reorder is skipped if no tracks are - removed. -f, --file If included, the script enters batch mode and converts the specified video file. WARNING: Do not use this argument when called @@ -1379,7 +1377,7 @@ get_mediainfo "$striptracks_video" # Process JSON data from MKVmerge; track selection logic striptracks_json_processed=$(echo "$striptracks_json" | jq -jcM --arg AudioKeep "$striptracks_audiokeep" \ --arg SubsKeep "$striptracks_subskeep" ' -# Parse input string into JSON language rules +# Parse input string into JSON language rules function def parse_language_codes(codes): # Supports f, d, and number modifiers (see issues #82 and #86) # -1 default value in language key means to keep unlimited tracks @@ -1505,7 +1503,7 @@ else . end | # Write messages to log echo "$striptracks_json_processed" | jq -crM --argjson Debug $striptracks_debug ' -# Join log messages into one line +# Join log messages into one line function def log_removed_tracks($type): if (.tracks | map(select(.type == $type and .striptracks_keep == false)) | length > 0) then "Info|Removing \($type) tracks: " + @@ -1532,42 +1530,23 @@ log_removed_tracks("subtitles"), "subtitles: \(.tracks | map(select(.type == "subtitles" and .striptracks_keep)) | length))" ' | log -# Check for no audio or subtitle tracks -if [ "$(echo "$striptracks_json_processed" | jq -crM '.tracks|map(select(.type=="audio" and .striptracks_keep))')" = "" ]; then - striptracks_message="Warn|Script encountered an error when determining audio tracks to keep and must close." +# Check for no audio tracks +if [ "$(echo "$striptracks_json_processed" | jq -crM '.tracks|map(select(.type=="audio" and .striptracks_keep))')" = "[]" ]; then + striptracks_message="Error|Unable to determine any audio tracks to keep. Exiting." echo "$striptracks_message" | log echo "$striptracks_message" >&2 end_script 11 fi -# All tracks matched/no tracks removed (see issues #49 and #89) -if [ "$(echo "$striptracks_json" | jq -crM '.tracks|map(select(.type=="audio" or .type=="subtitles"))|length')" = "$(echo "$striptracks_json_processed" | jq -crM '.tracks|map(select((.type=="audio" or .type=="subtitles") and .striptracks_keep))|length')" ]; then - [ $striptracks_debug -ge 1 ] && echo "Debug|No tracks will be removed from video \"$striptracks_video\"" | log - # Check if already MKV - if [[ $striptracks_video == *.mkv ]]; then - # Remuxing not performed - striptracks_message="Info|No tracks would be removed from video. Setting Title only and exiting." - echo "$striptracks_message" | log - striptracks_mkvcommand="/usr/bin/mkvpropedit -q --edit info --set \"title=$striptracks_title\" \"$striptracks_video\"" - [ $striptracks_debug -ge 1 ] && echo "Debug|Executing: $striptracks_mkvcommand" | log - striptracks_result=$(eval $striptracks_mkvcommand) - striptracks_return=$?; [ $striptracks_return -ne 0 ] && { - striptracks_message=$(echo -e "[$striptracks_return] Error when setting video title: \"$striptracks_tempvideo\"\nmkvpropedit returned: $striptracks_result" | awk '{print "Error|"$0}') - echo "$striptracks_message" | log - echo "$striptracks_message" >&2 - striptracks_exitstatus=13 - } - end_script - else - [ $striptracks_debug -ge 1 ] && echo "Debug|Source video is not MKV. Remuxing anyway." | log - fi -fi +# Map current track order +striptracks_order=$(echo "$striptracks_json_processed" | jq -jcM '.tracks | map(.id | "0:" + tostring) | join(",")') +[ $striptracks_debug -ge 1 ] && echo "Debug|Current mkvmerge track order: $striptracks_order" | log -# Prepare to reorder tracks if option is enabled +# Prepare to reorder tracks if option is enabled (see issue #92) if [ "$striptracks_reorder" = "true" ]; then striptracks_neworder=$(echo "$striptracks_json_processed" | jq -jcM --arg AudioKeep "$striptracks_audiokeep" \ --arg SubsKeep "$striptracks_subskeep" ' -# Reorder tracks +# Reorder tracks function def order_tracks(tracks; rules; tracktype): rules | split(":")[1:] | map(split("+") | {lang: .[0], mods: .[1]}) | reduce .[] as $rule ( @@ -1589,19 +1568,50 @@ def order_tracks(tracks; rules; tracktype): )] ) | flatten; -# Reorder audio and subtitles according to language rules +# Reorder audio and subtitles according to language code order .tracks as $tracks | order_tracks($tracks; $AudioKeep; "audio") as $audioOrder | order_tracks($tracks; $SubsKeep; "subtitles") as $subsOrder | # Output ordered track string compatible with the mkvmerge --track-order option # Video tracks are always first, followed by audio tracks, then subtitles +# NOTE: Other track types are still preserved as mkvmerge will automatically place any missing tracks after those listed per https://mkvtoolnix.download/doc/mkvmerge.html#d4e544 $tracks | map(select(.type == "video") | .id) + $audioOrder + $subsOrder | map("0:" + tostring) | join(",") ') - striptracks_neworder="--track-order $striptracks_neworder" - striptracks_message="Info|Reordering tracks using language rules." + [ $striptracks_debug -ge 1 ] && echo "Debug|New mkvmerge track order: $striptracks_neworder" | log + striptracks_message="Info|Reordering tracks using language code order." echo "$striptracks_message" | log - [ $striptracks_debug -ge 1 ] && echo "Debug|Using track reorder string: $striptracks_neworder" | log +fi + +# All tracks matched/no tracks removed (see issues #49 and #89) +if [ "$(echo "$striptracks_json" | jq -crM '.tracks|map(select(.type=="audio" or .type=="subtitles"))|length')" = "$(echo "$striptracks_json_processed" | jq -crM '.tracks|map(select((.type=="audio" or .type=="subtitles") and .striptracks_keep))|length')" ]; then + [ $striptracks_debug -ge 1 ] && echo "Debug|No tracks will be removed from video \"$striptracks_video\"" | log + # Check if already MKV + if [[ $striptracks_video == *.mkv ]]; then + # Check if reorder option is unset or if the order wouldn't change (see issue #92) + if [ "$striptracks_reorder" != "true" -o "$striptracks_order" = "$striptracks_neworder" ]; then + # Remuxing not performed + striptracks_message="Info|No tracks would be removed from video$( [ "$striptracks_reorder" = "true" ] && echo " or reordered"). Setting Title only and exiting." + echo "$striptracks_message" | log + striptracks_mkvcommand="/usr/bin/mkvpropedit -q --edit info --set \"title=$striptracks_title\" \"$striptracks_video\"" + [ $striptracks_debug -ge 1 ] && echo "Debug|Executing: $striptracks_mkvcommand" | log + striptracks_result=$(eval $striptracks_mkvcommand) + striptracks_return=$?; [ $striptracks_return -ne 0 ] && { + striptracks_message=$(echo -e "[$striptracks_return] Error when setting video title: \"$striptracks_tempvideo\"\nmkvpropedit returned: $striptracks_result" | awk '{print "Error|"$0}') + echo "$striptracks_message" | log + echo "$striptracks_message" >&2 + striptracks_exitstatus=13 + } + end_script + else + # Reorder tracks anyway + striptracks_message="Info|No tracks will be removed from video, but they can be reordered. Remuxing anyway." + echo "$striptracks_message" | log + fi + else + # Not MKV + [ $striptracks_debug -ge 1 ] && echo "Debug|Source video is not MKV. Remuxing anyway." | log + fi fi # Test for hardlinked file (see issue #85) @@ -1625,6 +1635,11 @@ else striptracks_subsarg="-S" fi +# Build argument for track reorder option for MKVmerge +if [ ${#striptracks_neworder} -ne 0 ]; then + striptracks_neworder="--track-order $striptracks_neworder" +fi + # Execute MKVmerge (remux then rename, see issue #46) striptracks_mkvcommand="nice /usr/bin/mkvmerge --title \"$striptracks_title\" -q -o \"$striptracks_tempvideo\" $striptracks_audioarg $striptracks_subsarg $striptracks_neworder \"$striptracks_video\"" [ $striptracks_debug -ge 1 ] && echo "Debug|Executing: $striptracks_mkvcommand" | log @@ -1722,7 +1737,7 @@ echo "$striptracks_message" | log #### Call Radarr/Sonarr API to RescanMovie/RescanSeries # Check for URL if [ "$striptracks_type" = "batch" ]; then - [ $striptracks_debug -ge 1 ] && echo "Debug|Cannot use API in batch mode." | log + [ $striptracks_debug -ge 1 ] && echo "Debug|Not calling API while in batch mode." | log elif [ -n "$striptracks_api_url" ]; then # Check for video IDs if [ "$striptracks_video_id" -a "$striptracks_videofile_id" ]; then From 7246fe3eba30495efe02db3faa6d364fdda0f9a0 Mon Sep 17 00:00:00 2001 From: TheCaptain989 Date: Mon, 21 Apr 2025 15:12:32 +0000 Subject: [PATCH 2/4] Minor changes (PATCH) - Log messages with version - Dockerfile case --- Dockerfile | 2 +- root/usr/local/bin/striptracks.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) mode change 100644 => 100755 root/usr/local/bin/striptracks.sh diff --git a/Dockerfile b/Dockerfile index b05466f9..bf44cde9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ # syntax=docker/dockerfile:1 ## Buildstage ## -FROM ghcr.io/linuxserver/baseimage-alpine:3.20 as buildstage +FROM ghcr.io/linuxserver/baseimage-alpine:3.20 AS buildstage ARG MOD_VERSION # copy local files diff --git a/root/usr/local/bin/striptracks.sh b/root/usr/local/bin/striptracks.sh old mode 100644 new mode 100755 index 1217414a..1dc9365c --- a/root/usr/local/bin/striptracks.sh +++ b/root/usr/local/bin/striptracks.sh @@ -199,7 +199,7 @@ while (( "$#" )); do exit 0 ;; --version ) # Display version - echo "$striptracks_script $striptracks_ver" + echo "${striptracks_script} ${striptracks_ver/{{VERSION\}\}/unknown}" exit 0 ;; -f|--file ) # Batch Mode @@ -1000,7 +1000,7 @@ done # Log Debug state if [ $striptracks_debug -ge 1 ]; then - striptracks_message="Debug|Enabling debug logging level ${striptracks_debug}. Starting run for: $striptracks_title" + striptracks_message="Debug|Running ${striptracks_script} version ${striptracks_ver/{{VERSION\}\}/unknown} with debug logging level ${striptracks_debug}. Video: $striptracks_title" echo "$striptracks_message" | log echo "$striptracks_message" >&2 fi From f6866e12c00d21d357b0e96f79555eacd7ca877e Mon Sep 17 00:00:00 2001 From: TheCaptain989 Date: Sat, 26 Apr 2025 10:38:33 -0500 Subject: [PATCH 3/4] Release 2.13.3 --- root/usr/local/bin/striptracks.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/root/usr/local/bin/striptracks.sh b/root/usr/local/bin/striptracks.sh index 1dc9365c..65cffee5 100755 --- a/root/usr/local/bin/striptracks.sh +++ b/root/usr/local/bin/striptracks.sh @@ -344,7 +344,7 @@ export striptracks_eventtype="${striptracks_type,,}_eventtype" export striptracks_newvideo="${striptracks_video%.*}.mkv" # If this were defined directly in Radarr or Sonarr this would not be needed here # shellcheck disable=SC2089 -striptracks_isocodemap='{"languages":[{"language":{"name":"Any","iso639-2":["any"]}},{"language":{"name":"Afrikaans","iso639-2":["afr"]}},{"language":{"name":"Albanian","iso639-2":["sqi","alb"]}},{"language":{"name":"Arabic","iso639-2":["ara"]}},{"language":{"name":"Bengali","iso639-2":["ben"]}},{"language":{"name":"Bosnian","iso639-2":["bos"]}},{"language":{"name":"Bulgarian","iso639-2":["bul"]}},{"language":{"name":"Catalan","iso639-2":["cat"]}},{"language":{"name":"Chinese","iso639-2":["zho","chi"]}},{"language":{"name":"Croatian","iso639-2":["hrv"]}},{"language":{"name":"Czech","iso639-2":["ces","cze"]}},{"language":{"name":"Danish","iso639-2":["dan"]}},{"language":{"name":"Dutch","iso639-2":["nld","dut"]}},{"language":{"name":"English","iso639-2":["eng"]}},{"language":{"name":"Estonian","iso639-2":["est"]}},{"language":{"name":"Finnish","iso639-2":["fin"]}},{"language":{"name":"Flemish","iso639-2":["nld","dut"]}},{"language":{"name":"French","iso639-2":["fra","fre"]}},{"language":{"name":"German","iso639-2":["deu","ger"]}},{"language":{"name":"Greek","iso639-2":["ell","gre"]}},{"language":{"name":"Hebrew","iso639-2":["heb"]}},{"language":{"name":"Hindi","iso639-2":["hin"]}},{"language":{"name":"Hungarian","iso639-2":["hun"]}},{"language":{"name":"Icelandic","iso639-2":["isl","ice"]}},{"language":{"name":"Indonesian","iso639-2":["ind"]}},{"language":{"name":"Italian","iso639-2":["ita"]}},{"language":{"name":"Japanese","iso639-2":["jpn"]}},{"language":{"name":"Kannada","iso639-2":["kan"]}},{"language":{"name":"Korean","iso639-2":["kor"]}},{"language":{"name":"Latvian","iso639-2":["lav"]}},{"language":{"name":"Lithuanian","iso639-2":["lit"]}},{"language":{"name":"Macedonian","iso639-2":["mac","mkd"]}},{"language":{"name":"Malayalam","iso639-2":["mal"]}},{"language":{"name":"Marathi","iso639-2":["mar"]}},{"language":{"name":"Norwegian","iso639-2":["nno","nob","nor"]}},{"language":{"name":"Persian","iso639-2":["fas","per"]}},{"language":{"name":"Polish","iso639-2":["pol"]}},{"language":{"name":"Portuguese","iso639-2":["por"]}},{"language":{"name":"Portuguese (Brazil)","iso639-2":["por"]}},{"language":{"name":"Romanian","iso639-2":["rum","ron"]}},{"language":{"name":"Russian","iso639-2":["rus"]}},{"language":{"name":"Serbian","iso639-2":["srp"]}},{"language":{"name":"Slovak","iso639-2":["slk","slo"]}},{"language":{"name":"Slovenian","iso639-2":["slv"]}},{"language":{"name":"Spanish","iso639-2":["spa"]}},{"language":{"name":"Spanish (Latino)","iso639-2":["spa"]}},{"language":{"name":"Swedish","iso639-2":["swe"]}},{"language":{"name":"Tagalog","iso639-2":["tgl"]}},{"language":{"name":"Tamil","iso639-2":["tam"]}},{"language":{"name":"Telugu","iso639-2":["tel"]}},{"language":{"name":"Thai","iso639-2":["tha"]}},{"language":{"name":"Turkish","iso639-2":["tur"]}},{"language":{"name":"Ukrainian","iso639-2":["ukr"]}},{"language":{"name":"Vietnamese","iso639-2":["vie"]}},{"language":{"name":"Unknown","iso639-2":["und"]}}]}' +striptracks_isocodemap='{"languages":[{"language":{"name":"Any","iso639-2":["any"]}},{"language":{"name":"Afrikaans","iso639-2":["afr"]}},{"language":{"name":"Albanian","iso639-2":["sqi","alb"]}},{"language":{"name":"Arabic","iso639-2":["ara"]}},{"language":{"name":"Bengali","iso639-2":["ben"]}},{"language":{"name":"Bosnian","iso639-2":["bos"]}},{"language":{"name":"Bulgarian","iso639-2":["bul"]}},{"language":{"name":"Catalan","iso639-2":["cat"]}},{"language":{"name":"Chinese","iso639-2":["zho","chi"]}},{"language":{"name":"Croatian","iso639-2":["hrv"]}},{"language":{"name":"Czech","iso639-2":["ces","cze"]}},{"language":{"name":"Danish","iso639-2":["dan"]}},{"language":{"name":"Dutch","iso639-2":["nld","dut"]}},{"language":{"name":"English","iso639-2":["eng"]}},{"language":{"name":"Estonian","iso639-2":["est"]}},{"language":{"name":"Finnish","iso639-2":["fin"]}},{"language":{"name":"Flemish","iso639-2":["nld","dut"]}},{"language":{"name":"French","iso639-2":["fra","fre"]}},{"language":{"name":"German","iso639-2":["deu","ger"]}},{"language":{"name":"Greek","iso639-2":["ell","gre"]}},{"language":{"name":"Hebrew","iso639-2":["heb"]}},{"language":{"name":"Hindi","iso639-2":["hin"]}},{"language":{"name":"Hungarian","iso639-2":["hun"]}},{"language":{"name":"Icelandic","iso639-2":["isl","ice"]}},{"language":{"name":"Indonesian","iso639-2":["ind"]}},{"language":{"name":"Italian","iso639-2":["ita"]}},{"language":{"name":"Japanese","iso639-2":["jpn"]}},{"language":{"name":"Kannada","iso639-2":["kan"]}},{"language":{"name":"Korean","iso639-2":["kor"]}},{"language":{"name":"Latvian","iso639-2":["lav"]}},{"language":{"name":"Lithuanian","iso639-2":["lit"]}},{"language":{"name":"Macedonian","iso639-2":["mac","mkd"]}},{"language":{"name":"Malayalam","iso639-2":["mal"]}},{"language":{"name":"Marathi","iso639-2":["mar"]}},{"language":{"name":"Norwegian","iso639-2":["nno","nob","nor"]}},{"language":{"name":"Persian","iso639-2":["fas","per"]}},{"language":{"name":"Polish","iso639-2":["pol"]}},{"language":{"name":"Portuguese","iso639-2":["por"]}},{"language":{"name":"Portuguese (Brazil)","iso639-2":["por"]}},{"language":{"name":"Romanian","iso639-2":["rum","ron"]}},{"language":{"name":"Russian","iso639-2":["rus"]}},{"language":{"name":"Serbian","iso639-2":["srp"]}},{"language":{"name":"Slovak","iso639-2":["slk","slo"]}},{"language":{"name":"Slovenian","iso639-2":["slv"]}},{"language":{"name":"Spanish","iso639-2":["spa"]}},{"language":{"name":"Spanish (Latino)","iso639-2":["spa"]}},{"language":{"name":"Swedish","iso639-2":["swe"]}},{"language":{"name":"Tagalog","iso639-2":["tgl"]}},{"language":{"name":"Tamil","iso639-2":["tam"]}},{"language":{"name":"Telugu","iso639-2":["tel"]}},{"language":{"name":"Thai","iso639-2":["tha"]}},{"language":{"name":"Turkish","iso639-2":["tur"]}},{"language":{"name":"Ukrainian","iso639-2":["ukr"]}},{"language":{"name":"Urdu","iso639-2":["urd"]}},{"language":{"name":"Vietnamese","iso639-2":["vie"]}},{"language":{"name":"Unknown","iso639-2":["und"]}}]}' ### Functions From f4c387e1e6ff2f6f4b8a273c9e2d1361ed69137c Mon Sep 17 00:00:00 2001 From: TheCaptain989 Date: Mon, 28 Apr 2025 07:55:01 -0500 Subject: [PATCH 4/4] Documentation update - Repositioned reorder option - Updated version --- .github/workflows/BuildImage.yml | 2 +- README.md | 4 ++-- root/usr/local/bin/striptracks.sh | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/BuildImage.yml b/.github/workflows/BuildImage.yml index 82e84c16..879c12f9 100644 --- a/.github/workflows/BuildImage.yml +++ b/.github/workflows/BuildImage.yml @@ -31,7 +31,7 @@ jobs: echo "MULTI_ARCH=${{ env.MULTI_ARCH }}" >> $GITHUB_OUTPUT if [[ -z "${{ env.MOD_VERSION }}" ]]; then # **** If the mod needs to be versioned, set the versioning logic below. Otherwise leave as is. **** - MOD_VERSION="2.13.1" + MOD_VERSION="2.13.3" else MOD_VERSION=${{ env.MOD_VERSION }} echo "MOD_VERSION_OVERRIDE=true" >> $GITHUB_OUTPUT diff --git a/README.md b/README.md index 43600bdb..671a947f 100644 --- a/README.md +++ b/README.md @@ -210,7 +210,7 @@ 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} [{-s|--subs} ] [--reorder] [{-f|--file} ]] [{-l|--log} ] [{-c|--config} ] [{-d|--debug} []]` +`striptracks.sh [{-a|--audio} [{-s|--subs} ] [{-f|--file} ]] [--reorder] [{-l|--log} ] [{-c|--config} ] [{-d|--debug} []]`
Table of Command-Line Arguments @@ -219,8 +219,8 @@ Option|Argument|Description ---|---|--- `-a`, `--audio`|``|Audio languages to keep
ISO 639-2 code(s) prefixed with a colon (`:`)
Each code may optionally be followed by a plus (`+`) and one or more [modifiers](#language-code-modifiers). `-s`, `--subs`|``|Subtitle languages to keep
ISO 639-2 code(s) prefixed with a colon (`:`)
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 `` and `` arguments. `-f`, `--file`|``|If included, the script enters **[Batch Mode](#batch-mode)** and converts the specified video file.
Requires the `--audio` option.
![notes] **Do not** use this argument when called from Radarr or Sonarr! +`--reorder`| |Reorder audio and subtitles tracks to match the language code order specified in the `` and `` arguments. `-l`, `--log`|``|The log filename
Default is `/config/log/striptracks.txt` `-c`, `--config`|``|Radarr/Sonarr XML configuration file
Default is `/config/config.xml` `-d`, `--debug`|`[]`|Enables debug logging. Level is optional.
Default is `1` (low)
`2` includes JSON output
`3` contains even more JSON output diff --git a/root/usr/local/bin/striptracks.sh b/root/usr/local/bin/striptracks.sh index 65cffee5..270698f2 100755 --- a/root/usr/local/bin/striptracks.sh +++ b/root/usr/local/bin/striptracks.sh @@ -76,7 +76,7 @@ mode. Source: https://github.com/TheCaptain989/radarr-striptracks Usage: - $0 [{-a|--audio} [{-s|--subs} ] [--reorder] [{-f|--file} ]] [{-l|--log} ] [{-c|--config} ] [{-d|--debug} []] + $0 [{-a|--audio} [{-s|--subs} ] [{-f|--file} ]] [--reorder] [{-l|--log} ] [{-c|--config} ] [{-d|--debug} []] Options can also be set via the STRIPTRACKS_ARGS environment variable. Command-line arguments override the environment variable. @@ -92,14 +92,14 @@ Options and Arguments: multiple codes may be concatenated. 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 - and - arguments. -f, --file If included, the script enters batch mode and converts the specified video file. WARNING: Do not use this argument when called from Radarr or Sonarr! + --reorder Reorder audio and subtitles tracks to match + the language code order specified in the + and + arguments. -l, --log Log filename [default: /config/log/striptracks.txt] -c, --config Radarr/Sonarr XML configuration file