Don't embed subtitles if the list is empty or the field is not set (fixes #1510)
authorJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>
Fri, 27 Sep 2013 06:08:43 +0000 (08:08 +0200)
committerJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>
Fri, 27 Sep 2013 06:08:43 +0000 (08:08 +0200)
youtube_dl/PostProcessor.py

index ae56d2082dec2b152a53b63b1629420e8e18cfec..3ee1d3c5865e203f564d87c8beb55a3de3a46934 100644 (file)
@@ -444,8 +444,11 @@ class FFmpegEmbedSubtitlePP(FFmpegPostProcessor):
         if information['ext'] != u'mp4':
             self._downloader.to_screen(u'[ffmpeg] Subtitles can only be embedded in mp4 files')
             return True, information
-        sub_langs = [key for key in information['subtitles']]
+        if not information.get('subtitles'):
+            self._downloader.to_screen(u'[ffmpeg] There aren\'t any subtitles to embed') 
+            return True, information
 
+        sub_langs = [key for key in information['subtitles']]
         filename = information['filepath']
         input_files = [filename] + [subtitles_filename(filename, lang, self._subformat) for lang in sub_langs]