mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-27 02:42:30 +00:00
parent
8f70b0b82f
commit
77c4a9ef68
@ -2363,20 +2363,24 @@ def process_subtitles(self, video_id, normal_subtitles, automatic_captions):
|
|||||||
if self.params.get('allsubtitles', False):
|
if self.params.get('allsubtitles', False):
|
||||||
requested_langs = all_sub_langs
|
requested_langs = all_sub_langs
|
||||||
elif self.params.get('subtitleslangs', False):
|
elif self.params.get('subtitleslangs', False):
|
||||||
requested_langs = set()
|
# A list is used so that the order of languages will be the same as
|
||||||
for lang in self.params.get('subtitleslangs'):
|
# given in subtitleslangs. See https://github.com/yt-dlp/yt-dlp/issues/1041
|
||||||
if lang == 'all':
|
requested_langs = []
|
||||||
requested_langs.update(all_sub_langs)
|
for lang_re in self.params.get('subtitleslangs'):
|
||||||
|
if lang_re == 'all':
|
||||||
|
requested_langs.extend(all_sub_langs)
|
||||||
continue
|
continue
|
||||||
discard = lang[0] == '-'
|
discard = lang_re[0] == '-'
|
||||||
if discard:
|
if discard:
|
||||||
lang = lang[1:]
|
lang_re = lang_re[1:]
|
||||||
current_langs = filter(re.compile(lang + '$').match, all_sub_langs)
|
current_langs = filter(re.compile(lang_re + '$').match, all_sub_langs)
|
||||||
if discard:
|
if discard:
|
||||||
for lang in current_langs:
|
for lang in current_langs:
|
||||||
requested_langs.discard(lang)
|
while lang in requested_langs:
|
||||||
|
requested_langs.remove(lang)
|
||||||
else:
|
else:
|
||||||
requested_langs.update(current_langs)
|
requested_langs.extend(current_langs)
|
||||||
|
requested_langs = orderedSet(requested_langs)
|
||||||
elif 'en' in available_subs:
|
elif 'en' in available_subs:
|
||||||
requested_langs = ['en']
|
requested_langs = ['en']
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user