[YoutubeDL] Autocalculate ext when ext is None
authorSergey M․ <dstftw@gmail.com>
Sun, 21 Aug 2016 01:07:26 +0000 (08:07 +0700)
committerSergey M․ <dstftw@gmail.com>
Sun, 21 Aug 2016 01:28:36 +0000 (08:28 +0700)
youtube_dl/YoutubeDL.py

index e844dc98a5b3915070ffae079395233de7ed04f7..0b3e3da823c13351abce111be2dd8ffa105212dc 100755 (executable)
@@ -1299,7 +1299,7 @@ class YoutubeDL(object):
                 for subtitle_format in subtitle:
                     if subtitle_format.get('url'):
                         subtitle_format['url'] = sanitize_url(subtitle_format['url'])
-                    if 'ext' not in subtitle_format:
+                    if subtitle_format.get('ext') is None:
                         subtitle_format['ext'] = determine_ext(subtitle_format['url']).lower()
 
         if self.params.get('listsubtitles', False):
@@ -1354,7 +1354,7 @@ class YoutubeDL(object):
                     note=' ({0})'.format(format['format_note']) if format.get('format_note') is not None else '',
                 )
             # Automatically determine file extension if missing
-            if 'ext' not in format:
+            if format.get('ext') is None:
                 format['ext'] = determine_ext(format['url']).lower()
             # Automatically determine protocol if missing (useful for format
             # selection purposes)