You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+43-6Lines changed: 43 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -181,22 +181,25 @@ graph LR
181
181
A[Command-Line]
182
182
B["Environment
183
183
Variable"]
184
-
C["Quality
185
-
Profile"]
184
+
C{"Quality
185
+
Profile"}
186
186
D["Custom
187
187
Formats"]
188
188
E["Language Profile
189
189
(Sonarr only)"]
190
+
F(["Exit"])
190
191
A-->B
191
192
B-->C
192
193
C-- 'Any' -->D
194
+
C-- "--skip-profile" -->F
193
195
D-->E
194
196
```
195
197
196
198
Descriptively, these steps are:
197
199
1. Command-line arguments override all automatic language selection.
198
200
2. Environment variable is checked for arguments.
199
201
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).
202
+
1. If the *Quality Profile* name matches one of the names specified with the `--skip-profile` option, stop processing and exit.
200
203
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.
201
204
All language conditions with positive scores *and* Negated conditions with negative scores *and* non-Negated Except Language conditions with negative scores are selected.
202
205
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)
@@ -210,18 +213,22 @@ All language conditions with positive scores *and* Negated conditions with negat
210
213
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).
<summary>Table of Command-Line Arguments</summary>
217
221
218
222
Option|Argument|Description
219
223
---|---|---
220
-
`-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).
221
-
`-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.
224
+
`-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).
225
+
`-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.
222
226
`-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!
223
227
`--reorder`| |Reorder audio and subtitles tracks to match the language code order specified in the `<audio_languages>` and `<subtitle_languages>` arguments.
224
228
`--disable-recycle`| |Disable recycle bin use, even if configured in Radarr/Sonarr
229
+
`--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.
225
232
`-l`, `--log`|`<log_file>`|The log filename<br/>Default is `/config/log/striptracks.txt`
226
233
`-c`, `--config`|`<config_file>`|Radarr/Sonarr XML configuration file<br/>Default is `/config/config.xml`
227
234
`-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!
@@ -246,14 +253,19 @@ Multiple codes may be concatenated, such as `:eng:spa` for both English and Span
246
253
> If no subtitle language is detected via Radarr/Sonarr configuration or specified on the command-line, all subtitles are removed.
247
254
248
255
### Language Code Modifiers
249
-
Each language code can optionally be followed by a plus (`+`) and one or more modifier characters. Supported modifiers are:
256
+
Each language code can optionally be followed by a plus (`+`) and one or more modifier characters. Supported modifiers are in the table below.
257
+
258
+
<details>
259
+
<summary>Table of Language Code Modifiers</summary>
250
260
251
261
Modifier|Function
252
262
---|---
253
263
`f`|Selects only tracks with the forced flag set
254
264
`d`|Selects only tracks with the default flag set
255
265
`[0-9]`|Specifies the maximum number of tracks to select.<br/>Based on the order of the tracks in the original source video.
256
266
267
+
</details>
268
+
257
269
These modifiers must be applied to each language code you want to modify. They may be used with either audio or subtitles codes.
258
270
For example, the following options, `--audio :org:any+d --subs :eng+1:any+f` would keep:
259
271
- All original language audio tracks, and all Default audio tracks regardless of language
@@ -265,6 +277,30 @@ Modifiers may be combined, such as `:any+fd` to keep all forced and all default
265
277
> Note the exact phrasing of the previous sentence. There is nuance here that is not obvious.
266
278
> `:any+fd` is equivalent to `:any+f:any+d`, but `:eng+1d` is **not** the same as `:eng+1:eng+d`.
267
279
280
+
### Setting Default Track
281
+
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.
282
+
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.
283
+
284
+
The language code can optionally be follow 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.
286
+
287
+
The setting of default track flags occurs after the track selection logic.
288
+
289
+
> [!NOTE]
290
+
> This is not a robust feature. It relies heavily on the track order and names from the source video file.
291
+
> You may therefore not obtain consistent results.
292
+
293
+
<details>
294
+
<summary>Track Name Examples</summary>
295
+
296
+
If you want to set the default subtitles track to the first hearing impared English track, you would use:
297
+
`--set-default-subs :eng=SDH`
298
+
299
+
To set the default audio track to Dutch:
300
+
`--set-default-audio :dut`
301
+
302
+
</details>
303
+
268
304
### Any language code
269
305
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.
270
306
@@ -452,6 +488,7 @@ Because the script is not called from within Radarr or Sonarr, their database is
452
488
* *The filename must be specified on the command-line.*<br/>The `-f` option places the script in Batch Mode
453
489
* *No audio or subtitles language detection occurs.*<br/>Both the audio and subtitles languages must be specified on the command-line.
454
490
* *The `:org` language code is meaningless.*<br/>The original video language cannot be determined.
491
+
* *Profile skipping is not available.*
455
492
* *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.
456
493
* *Radarr or Sonarr APIs are not called and their database is not updated.*<br/>This may require a manual rescan of converted videos.
457
494
* *Original video files are deleted.*<br/>The Recycle Bin function is not available.
0 commit comments