Skip to content

Commit 47976f0

Browse files
committed
Release 2.19.0
1 parent 61e0011 commit 47976f0

File tree

4 files changed

+61
-25
lines changed

4 files changed

+61
-25
lines changed

.github/workflows/BuildImage.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
echo "MULTI_ARCH=${{ env.MULTI_ARCH }}" >> $GITHUB_OUTPUT
3333
if [[ -z "${{ env.MOD_VERSION }}" ]]; then
3434
# **** If the mod needs to be versioned, set the versioning logic below. Otherwise leave as is. ****
35-
MOD_VERSION="2.18.0"
35+
MOD_VERSION="2.19.0"
3636
else
3737
MOD_VERSION=${{ env.MOD_VERSION }}
3838
echo "MOD_VERSION_OVERRIDE=true" >> $GITHUB_OUTPUT

README.md

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ All language conditions with positive scores *and* Negated conditions with negat
213213
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).
214214

215215
The syntax for the command-line is:
216-
`striptracks.sh [{-a|--audio} <audio_languages[+modifier]> [{-s|--subs} <subtitle_languages[+modifier]>] [{-f|--file} <video_file>]] [--reorder] [--disable-recycle] [--skip-profile <profile_name>]... [--set-default-audio <language_code[=name]>] [--set-default-subs <language_code[=name]>]
216+
`striptracks.sh [{-a|--audio} <audio_languages[+modifier]> [{-s|--subs} <subtitle_languages[+modifier]>] [{-f|--file} <video_file>]] [--reorder] [--disable-recycle] [--skip-profile <profile_name>]... [--set-default-audio <language_code[=name][-f]>] [--set-default-subs <language_code[=name][-f]>]
217217
[{-l|--log} <log_file>] [{-c|--config} <config_file>] [{-p|--priority} {idle|low|medium|high}] [{-d|--debug} [<level>]]`
218218

219219
<details>
@@ -224,17 +224,17 @@ Option|Argument|Description
224224
`-a`, `--audio`|`<audio_languages[+modifier]>`|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).
225225
`-s`, `--subs`|`<subtitle_languages[+modifier]>`|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.
226226
`-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!
227-
`--reorder`| |Reorder audio and subtitles tracks to match the language code order specified in the `<audio_languages>` and `<subtitle_languages>` arguments.
228-
`--disable-recycle`| |Disable recycle bin use, even if configured in Radarr/Sonarr
227+
`--reorder`||Reorder audio and subtitles tracks to match the language code order specified in the `<audio_languages>` and `<subtitle_languages>` arguments.
228+
`--disable-recycle`||Disable recycle bin use, even if configured in Radarr/Sonarr
229229
`--skip-profile`|`<profile_name>`|Skip processing if the video was downloaded using the specified Quality Profile name. May be specified multiple times to skip multiple profiles.
230-
`--set-default-audio`|`<language_code[=name]>`|Set the default audio track to the first track of the specified language. Only one language code is allowed. If specified, all other tracks are marked as not default.<br/>The code may optionally be followed by an equals (`=`) and a [track name](#setting-default-track) matching string.
231-
`--set-default-subs`|`<language_code[=name]>`|Set the default subtitles track to the first track of the specified language. Only one language code is allowed. If specified, all other tracks are marked as not default.<br/>The code may optionally be followed by an equals (`=`) and a track name string.
230+
`--set-default-audio`|`<language_code[=name][-f]>`|Set the default audio track to the first track of the specified language. Only one language code is allowed. If specified, all other tracks are marked as not default.<br/>The code may optionally be followed by an equals (`=`) and a [track name](#setting-default-track) matching string.<br/>The code may optionally be followed by a minus f (`-f`) to indicate skipping Forced tracks.
231+
`--set-default-subs`|`<language_code[=name][-f]>`|Set the default subtitles track to the first track of the specified language. Only one language code is allowed. If specified, all other tracks are marked as not default.<br/>The code may optionally be followed by an equals (`=`) and a track name string.<br/>The code may optionally be followed by a minus f (`-f`) to indicate skipping Forced tracks.
232232
`-l`, `--log`|`<log_file>`|The log filename<br/>Default is `/config/log/striptracks.txt`
233233
`-c`, `--config`|`<config_file>`|Radarr/Sonarr XML configuration file<br/>Default is `/config/config.xml`
234234
`-p`, `--priority`|`idle`, `low`, `medium`, `high`|CPU and I/O process priority for mkvmerge<br/>Default is `medium`<br/>![notes] High priority can consume all system resources. When processing a large video file your system may become unresponsive!
235235
`-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
236-
`--help`| |Display help and exit.
237-
`--version`| |Display version and exit.
236+
`--help`||Display help and exit.
237+
`--version`||Display version and exit.
238238

239239
</details>
240240

@@ -281,8 +281,12 @@ Modifiers may be combined, such as `:any+fd` to keep all forced and all default
281281
Use the `--set-default` options to choose tracks that appear first when the video is played. Only one audio and one subtitles track may be set as default. The language code is the same colon (`:`) prepended ISO 639-2 language code used with the `--audio` and `--subs` options.
282282
The first track of the specified language will have its default flag set and all other tracks (of any language) will have their default flag disabled.
283283

284-
The language code can optionally be followed by an equals (`=`) and a string which is used to match against the track name. The first track that matches the specified language and with a name that matches the string will be set to default.
285-
The string matching uses a substring and is case insensitive. You can use this to set the default subtitles track to hearing impared (SDH), or the audio track to your preferred language.
284+
The language code can optionally be followed by an equals (`=`) and a string which is matched against the track name. The first track that matches the specified language and with a name that matches the string will be set to default.
285+
The string matching uses a substring and is case insensitive. You could use this to set the default subtitles track to hearing impared (SDH), for example.
286+
287+
The language code can optionally be followed by a minus f (`-f`) which indicates skipping tracks that have the forced flag set when choosing the default track.
288+
289+
The order of the `=name` and `-f` modifiers is not important.
286290

287291
The setting of default track flags occurs after the track selection logic.
288292

@@ -291,14 +295,17 @@ The setting of default track flags occurs after the track selection logic.
291295
> You may therefore not obtain consistent results.
292296

293297
<details>
294-
<summary>Track Name Examples</summary>
298+
<summary>Default Track Examples</summary>
295299

296300
If you want to set the default subtitles track to the first hearing impared English track, you would use:
297301
`--set-default-subs :eng=SDH`
298302

299303
To set the default audio track to Dutch:
300304
`--set-default-audio :dut`
301305

306+
To set the default subtitles track to the first non-forced English track:
307+
`--set-default-subs :eng-f`
308+
302309
</details>
303310

304311
### Any language code
@@ -379,6 +386,12 @@ There is no way to force the script to remove audio tracks with these codes.
379386
# (first audio track flagged as Default as it appears in the source file),
380387
# one English subtitles track and two forced subtitles regardless of
381388
# language (as they appear in the source file)
389+
--audio :org:eng:fre:fra --subs :org:eng:fre:fra --reorder --disable-recycle --set-default-audio :org --set-default-subs :eng-f
390+
# Keep the Original, English, and French audio and subtitles
391+
# Reorder the tracks to match the above order (audio first, then substitles)
392+
# Set the first Original language audio track as default
393+
# Set the first non-forced English subtitles tracks as default
394+
# Force delete the original video after remuxing
382395
```
383396

384397
</details>

SECURITY.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ Only the latest major and minor version are supported.
66

77
| Version | Supported |
88
| ------- | ------------------ |
9-
| 2.18.x | :heavy_check_mark: |
10-
| < 2.18 | :x: |
9+
| 2.19.x | :heavy_check_mark: |
10+
| < 2.19 | :x: |
1111

1212
## Reporting a Vulnerability
1313

root/usr/local/bin/striptracks.sh

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ mode.
122122
Source: https://github.com/TheCaptain989/radarr-striptracks
123123
124124
Usage:
125-
$0 [{-a|--audio} <audio_languages> [{-s|--subs} <subtitle_languages>] [{-f|--file} <video_file>]] [--reorder] [--disable-recycle] [--skip-profile <profile_name>]... [--set-default-audio <language_code[=name]>] [--set-default-subs <language_code[=name]>] [{-l|--log} <log_file>] [{-c|--config} <config_file>] [{-p|--priority} {idle|low|medium|high}] [{-d|--debug} [<level>]]
125+
$0 [{-a|--audio} <audio_languages> [{-s|--subs} <subtitle_languages>] [{-f|--file} <video_file>]] [--reorder] [--disable-recycle] [--skip-profile <profile_name>]... [--set-default-audio <language_code[=name][-f]>] [--set-default-subs <language_code[=name][-f]>] [{-l|--log} <log_file>] [{-c|--config} <config_file>] [{-p|--priority} {idle|low|medium|high}] [{-d|--debug} [<level>]]
126126
127127
Options can also be set via the STRIPTRACKS_ARGS environment variable.
128128
Command-line arguments override the environment variable.
@@ -155,16 +155,22 @@ Options and Arguments:
155155
using the specified quality profile name.
156156
May be specified multiple times to skip
157157
multiple profiles.
158-
--set-default-audio <language_code[=name]>
158+
--set-default-audio <language_code[=name][-f]>
159159
Set the default audio track to the first
160160
track of the specified language.
161161
The code may optionally be followed by an
162162
equals \`=\` and a track name.
163-
--set-default-subs <language_code[=name]>
163+
The code may optionally be followed by a
164+
minus \`-f\` to indicate skipping Forced
165+
tracks.
166+
--set-default-subs <language_code[=name][-f]>
164167
Set the default subtitles track to the first
165168
track of the specified language.
166169
The code may optionally be followed by an
167-
equals \`+\` and a track name.
170+
equals \`=\` and a track name.
171+
The code may optionally be followed by a
172+
minus \`-f\` to indicate skipping Forced
173+
tracks.
168174
-l, --log <log_file> Log filename
169175
[default: /config/log/striptracks.txt]
170176
-c, --config <config_file> Radarr/Sonarr XML configuration file
@@ -1582,7 +1588,7 @@ function determine_track_order {
15821588
fi
15831589
}
15841590
function set_default_tracks {
1585-
# Build mkvpropedit paramaters to set default flags on audio and subtitle tracks.
1591+
# Build mkvpropedit parameters to set default flags on audio and subtitle tracks.
15861592

15871593
# Process audio and subtitle --set-default track settings
15881594
for tracktype in audio subtitles; do
@@ -1597,15 +1603,32 @@ function set_default_tracks {
15971603
# Use jq to find the track ID using case-insensitive substring match on track name
15981604
local track_id=$(echo "$striptracks_json_processed" | jq -crM --arg type "$tracktype" --arg currentcfg "$currentcfg" '
15991605
def parse_cfg(cfg):
1600-
cfg | ltrimstr(":") | split("=") | {lang: .[0], name: .[1]};
1601-
1602-
(parse_cfg($currentcfg)).lang as $lang |
1603-
(parse_cfg($currentcfg)).name as $name |
1606+
# Remove leading ":" then split on "=" (if present)
1607+
# Supports f as a modifier (see issue #113)
1608+
(cfg | ltrimstr(":") | split("=")) as $eq |
1609+
($eq[0]) as $left |
1610+
(if ($eq | length > 1) then $eq[1] else "" end) as $right |
1611+
1612+
# Detect trailing "-f" on left or right and strip it; only "f" is a valid modifier
1613+
(if ($left | test("-f$")) then {lang: ($left | sub("-f$"; "")), skip: true} else {lang: $left, skip: false} end) as $leftinfo |
1614+
1615+
(if $right == "" then
1616+
$leftinfo + {name: ""}
1617+
else
1618+
(if ($right | test("-f$")) then
1619+
$leftinfo + {name: ($right | sub("-f$"; "")), skip: true}
1620+
else
1621+
$leftinfo + {name: $right}
1622+
end)
1623+
end);
1624+
1625+
parse_cfg($currentcfg) as $rule |
16041626
.tracks |
16051627
map(. as $track |
1606-
(($lang == "any" or $lang == $track.language) as $lang_match |
1607-
($name == "" or (($track.name // "") | ascii_downcase | contains(($name // "") | ascii_downcase))) as $name_match |
1608-
select($track.type == $type and $lang_match and $name_match and .striptracks_keep)
1628+
(($rule.lang == "any" or $rule.lang == $track.language) as $lang_match |
1629+
($rule.name == "" or (($track.name // "") | ascii_downcase | contains(($rule.name // "") | ascii_downcase))) as $name_match |
1630+
($rule.skip and $track.forced) as $skipped |
1631+
select($track.type == $type and $lang_match and $name_match and ($skipped | not) and .striptracks_keep)
16091632
)
16101633
) |
16111634
.[0].id // ""

0 commit comments

Comments
 (0)