1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2025-10-04 19:36:18 -04:00

Improve --sub-langs (see desc)

* Treat `--sub-langs` entries as regex
* `all` can be used to refer to all the subtitles
* the language code can be prefixed with `-` to exclude it
* Deprecates `--all-subs`
Closes #253
This commit is contained in:
pukkandan
2021-04-20 02:47:09 +05:30
parent 3097d9e512
commit c32b0aab8a
4 changed files with 59 additions and 16 deletions

View File

@@ -548,7 +548,7 @@ def parseOpts(overrideArguments=None):
subtitles.add_option(
'--all-subs',
action='store_true', dest='allsubtitles', default=False,
help='Download all the available subtitles of the video')
help=optparse.SUPPRESS_HELP)
subtitles.add_option(
'--list-subs',
action='store_true', dest='listsubtitles', default=False,
@@ -561,7 +561,10 @@ def parseOpts(overrideArguments=None):
'--sub-langs', '--srt-langs',
action='callback', dest='subtitleslangs', metavar='LANGS', type='str',
default=[], callback=_comma_separated_values_options_callback,
help='Languages of the subtitles to download (optional) separated by commas, use --list-subs for available language tags')
help=(
'Languages of the subtitles to download (can be regex) or "all" separated by commas. (Eg: --sub-langs en.*,ja) '
'You can prefix the language code with a "-" to exempt it from the requested languages. (Eg: --sub-langs all,-live_chat) '
'Use --list-subs for a list of available language tags'))
downloader = optparse.OptionGroup(parser, 'Download Options')
downloader.add_option(