mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-23 03:21:18 +01:00
De-prioritize automatic-subtitles when no --sub-lang
is given
Closes #3314
This commit is contained in:
parent
4d57133095
commit
d8a58ddce7
|
@ -2671,9 +2671,10 @@ def is_wellformed(f):
|
|||
|
||||
def process_subtitles(self, video_id, normal_subtitles, automatic_captions):
|
||||
"""Select the requested subtitles and their format"""
|
||||
available_subs = {}
|
||||
available_subs, normal_sub_langs = {}, []
|
||||
if normal_subtitles and self.params.get('writesubtitles'):
|
||||
available_subs.update(normal_subtitles)
|
||||
normal_sub_langs = tuple(normal_subtitles.keys())
|
||||
if automatic_captions and self.params.get('writeautomaticsub'):
|
||||
for lang, cap_info in automatic_captions.items():
|
||||
if lang not in available_subs:
|
||||
|
@ -2684,7 +2685,7 @@ def process_subtitles(self, video_id, normal_subtitles, automatic_captions):
|
|||
available_subs):
|
||||
return None
|
||||
|
||||
all_sub_langs = available_subs.keys()
|
||||
all_sub_langs = tuple(available_subs.keys())
|
||||
if self.params.get('allsubtitles', False):
|
||||
requested_langs = all_sub_langs
|
||||
elif self.params.get('subtitleslangs', False):
|
||||
|
@ -2709,10 +2710,10 @@ def process_subtitles(self, video_id, normal_subtitles, automatic_captions):
|
|||
else:
|
||||
requested_langs.extend(current_langs)
|
||||
requested_langs = orderedSet(requested_langs)
|
||||
elif 'en' in available_subs:
|
||||
requested_langs = ['en']
|
||||
elif normal_sub_langs:
|
||||
requested_langs = ['en'] if 'en' in normal_sub_langs else normal_sub_langs[:1]
|
||||
else:
|
||||
requested_langs = [list(all_sub_langs)[0]]
|
||||
requested_langs = ['en'] if 'en' in all_sub_langs else all_sub_langs[:1]
|
||||
if requested_langs:
|
||||
self.write_debug('Downloading subtitles: %s' % ', '.join(requested_langs))
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user