1
0
mirror of https://codeberg.org/polarisfm/youtube-dl synced 2024-11-26 02:14:32 +01:00

Add language prefixes for --sub-lang

This commit is contained in:
James Tai 2019-12-29 17:29:09 -08:00
parent 75ef77c1b1
commit f64af79b0c
No known key found for this signature in database
GPG Key ID: B3AF74657819B7DB

View File

@ -1664,7 +1664,13 @@ class YoutubeDL(object):
requested_langs = available_subs.keys()
else:
if self.params.get('subtitleslangs', False):
requested_langs = self.params.get('subtitleslangs')
requested_langs = []
for lang in self.params.get('subtitleslangs'):
if lang.endswith('*'):
prefix = lang[:-1]
requested_langs += [l for l in available_subs.keys() if l.startswith(prefix)]
else:
requested_langs.append(lang)
elif 'en' in available_subs:
requested_langs = ['en']
else: