mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-09-05 10:29:35 +02:00
[YoutubeDL] only add normal subtitles to the 'requested_subtitles' field if 'writesubtitles' is True
This commit is contained in:
parent
ab84349b16
commit
98c70d6fc7
@ -389,6 +389,13 @@ def get_info(params={}):
|
|||||||
self.assertFalse(subs['es']['_auto'])
|
self.assertFalse(subs['es']['_auto'])
|
||||||
self.assertTrue(subs['pt']['_auto'])
|
self.assertTrue(subs['pt']['_auto'])
|
||||||
|
|
||||||
|
result = get_info({'writeautomaticsub': True, 'subtitleslangs': ['es', 'pt']})
|
||||||
|
subs = result['requested_subtitles']
|
||||||
|
self.assertTrue(subs)
|
||||||
|
self.assertEqual(set(subs.keys()), set(['es', 'pt']))
|
||||||
|
self.assertTrue(subs['es']['_auto'])
|
||||||
|
self.assertTrue(subs['pt']['_auto'])
|
||||||
|
|
||||||
def test_add_extra_info(self):
|
def test_add_extra_info(self):
|
||||||
test_dict = {
|
test_dict = {
|
||||||
'extractor': 'Foo',
|
'extractor': 'Foo',
|
||||||
|
@ -1156,11 +1156,13 @@ def process_video_result(self, info_dict, download=True):
|
|||||||
info_dict.update(formats_to_download[-1])
|
info_dict.update(formats_to_download[-1])
|
||||||
return info_dict
|
return info_dict
|
||||||
|
|
||||||
def process_subtitles(self, video_id, available_subs, available_autocaps):
|
def process_subtitles(self, video_id, normal_subtitles, automatic_captions):
|
||||||
"""Select the requested subtitles and their format"""
|
"""Select the requested subtitles and their format"""
|
||||||
if available_autocaps and self.params.get('writeautomaticsub'):
|
available_subs = {}
|
||||||
available_subs = available_subs.copy()
|
if normal_subtitles and self.params.get('writesubtitles'):
|
||||||
for lang, cap_info in available_autocaps.items():
|
available_subs.update(normal_subtitles)
|
||||||
|
if automatic_captions and self.params.get('writeautomaticsub'):
|
||||||
|
for lang, cap_info in automatic_captions.items():
|
||||||
if lang not in available_subs:
|
if lang not in available_subs:
|
||||||
available_subs[lang] = cap_info
|
available_subs[lang] = cap_info
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user