mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-09-05 10:29:35 +02:00
[YoutubeDL] don't set the 'requested_subtitles' without writesubtitles or writeautomaticsub
This commit is contained in:
parent
fb7cb6823e
commit
4d17184817
@ -113,7 +113,7 @@ def test_youtube_nosubtitles(self):
|
|||||||
self.DL.params['writesubtitles'] = True
|
self.DL.params['writesubtitles'] = True
|
||||||
self.DL.params['allsubtitles'] = True
|
self.DL.params['allsubtitles'] = True
|
||||||
subtitles = self.getSubtitles()
|
subtitles = self.getSubtitles()
|
||||||
self.assertEqual(len(subtitles), 0)
|
self.assertFalse(subtitles)
|
||||||
|
|
||||||
def test_youtube_multiple_langs(self):
|
def test_youtube_multiple_langs(self):
|
||||||
self.url = 'QRS8MkLhQmM'
|
self.url = 'QRS8MkLhQmM'
|
||||||
@ -152,7 +152,7 @@ def test_nosubtitles(self):
|
|||||||
self.DL.params['writesubtitles'] = True
|
self.DL.params['writesubtitles'] = True
|
||||||
self.DL.params['allsubtitles'] = True
|
self.DL.params['allsubtitles'] = True
|
||||||
subtitles = self.getSubtitles()
|
subtitles = self.getSubtitles()
|
||||||
self.assertEqual(len(subtitles), 0)
|
self.assertFalse(subtitles)
|
||||||
|
|
||||||
def test_multiple_langs(self):
|
def test_multiple_langs(self):
|
||||||
self.DL.params['writesubtitles'] = True
|
self.DL.params['writesubtitles'] = True
|
||||||
@ -246,7 +246,7 @@ def test_nosubtitles(self):
|
|||||||
self.DL.params['writesubtitles'] = True
|
self.DL.params['writesubtitles'] = True
|
||||||
self.DL.params['allsubtitles'] = True
|
self.DL.params['allsubtitles'] = True
|
||||||
subtitles = self.getSubtitles()
|
subtitles = self.getSubtitles()
|
||||||
self.assertEqual(len(subtitles), 0)
|
self.assertFalse(subtitles)
|
||||||
|
|
||||||
def test_multiple_langs(self):
|
def test_multiple_langs(self):
|
||||||
self.DL.params['writesubtitles'] = True
|
self.DL.params['writesubtitles'] = True
|
||||||
@ -281,7 +281,7 @@ def test_nosubtitles(self):
|
|||||||
self.DL.params['writesubtitles'] = True
|
self.DL.params['writesubtitles'] = True
|
||||||
self.DL.params['allsubtitles'] = True
|
self.DL.params['allsubtitles'] = True
|
||||||
subtitles = self.getSubtitles()
|
subtitles = self.getSubtitles()
|
||||||
self.assertEqual(len(subtitles), 0)
|
self.assertFalse(subtitles)
|
||||||
|
|
||||||
|
|
||||||
class TestCeskaTelevizeSubtitles(BaseTestSubtitles):
|
class TestCeskaTelevizeSubtitles(BaseTestSubtitles):
|
||||||
@ -308,7 +308,7 @@ def test_nosubtitles(self):
|
|||||||
self.DL.params['writesubtitles'] = True
|
self.DL.params['writesubtitles'] = True
|
||||||
self.DL.params['allsubtitles'] = True
|
self.DL.params['allsubtitles'] = True
|
||||||
subtitles = self.getSubtitles()
|
subtitles = self.getSubtitles()
|
||||||
self.assertEqual(len(subtitles), 0)
|
self.assertFalse(subtitles)
|
||||||
|
|
||||||
|
|
||||||
class TestLyndaSubtitles(BaseTestSubtitles):
|
class TestLyndaSubtitles(BaseTestSubtitles):
|
||||||
|
@ -1164,8 +1164,10 @@ def process_subtitles(self, video_id, available_subs, available_autocaps):
|
|||||||
if lang not in available_subs:
|
if lang not in available_subs:
|
||||||
available_subs[lang] = cap_info
|
available_subs[lang] = cap_info
|
||||||
|
|
||||||
if not available_subs:
|
if (not self.params.get('writesubtitles') and not
|
||||||
return available_subs
|
self.params.get('writeautomaticsub') or not
|
||||||
|
available_subs):
|
||||||
|
return None
|
||||||
|
|
||||||
if self.params.get('allsubtitles', False):
|
if self.params.get('allsubtitles', False):
|
||||||
requested_langs = available_subs.keys()
|
requested_langs = available_subs.keys()
|
||||||
|
Loading…
Reference in New Issue
Block a user