[YoutubeDL] don't set the 'requested_subtitles' without writesubtitles or writeautoma...
authorJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>
Sat, 21 Feb 2015 21:31:53 +0000 (22:31 +0100)
committerJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>
Sat, 21 Feb 2015 23:27:49 +0000 (00:27 +0100)
test/test_subtitles.py
youtube_dl/YoutubeDL.py

index c04fe6f220653f362bb7b04afb59d7c9e1366eac..457f268fa3a7b33b342a8f40a329fa4958c3cd05 100644 (file)
@@ -113,7 +113,7 @@ class TestYoutubeSubtitles(BaseTestSubtitles):
         self.DL.params['writesubtitles'] = True
         self.DL.params['allsubtitles'] = True
         subtitles = self.getSubtitles()
-        self.assertEqual(len(subtitles), 0)
+        self.assertFalse(subtitles)
 
     def test_youtube_multiple_langs(self):
         self.url = 'QRS8MkLhQmM'
@@ -152,7 +152,7 @@ class TestDailymotionSubtitles(BaseTestSubtitles):
         self.DL.params['writesubtitles'] = True
         self.DL.params['allsubtitles'] = True
         subtitles = self.getSubtitles()
-        self.assertEqual(len(subtitles), 0)
+        self.assertFalse(subtitles)
 
     def test_multiple_langs(self):
         self.DL.params['writesubtitles'] = True
@@ -246,7 +246,7 @@ class TestVimeoSubtitles(BaseTestSubtitles):
         self.DL.params['writesubtitles'] = True
         self.DL.params['allsubtitles'] = True
         subtitles = self.getSubtitles()
-        self.assertEqual(len(subtitles), 0)
+        self.assertFalse(subtitles)
 
     def test_multiple_langs(self):
         self.DL.params['writesubtitles'] = True
@@ -281,7 +281,7 @@ class TestWallaSubtitles(BaseTestSubtitles):
         self.DL.params['writesubtitles'] = True
         self.DL.params['allsubtitles'] = True
         subtitles = self.getSubtitles()
-        self.assertEqual(len(subtitles), 0)
+        self.assertFalse(subtitles)
 
 
 class TestCeskaTelevizeSubtitles(BaseTestSubtitles):
@@ -308,7 +308,7 @@ class TestCeskaTelevizeSubtitles(BaseTestSubtitles):
         self.DL.params['writesubtitles'] = True
         self.DL.params['allsubtitles'] = True
         subtitles = self.getSubtitles()
-        self.assertEqual(len(subtitles), 0)
+        self.assertFalse(subtitles)
 
 
 class TestLyndaSubtitles(BaseTestSubtitles):
index f8b8fb0c18df3bc1e86903f095b48782a8c38a93..088b111eb835f684bf934b4ba9a2334a9822f43a 100755 (executable)
@@ -1164,8 +1164,10 @@ class YoutubeDL(object):
                 if lang not in available_subs:
                     available_subs[lang] = cap_info
 
-        if not available_subs:
-            return available_subs
+        if (not self.params.get('writesubtitles') and not
+                self.params.get('writeautomaticsub') or not
+                available_subs):
+            return None
 
         if self.params.get('allsubtitles', False):
             requested_langs = available_subs.keys()