]> gitweb @ CieloNegro.org - youtube-dl.git/commitdiff
[common] Prefer the manifest than formats_dict in determining codecs
authorYen Chi Hsuan <yan12125@gmail.com>
Sat, 30 Jan 2016 13:42:27 +0000 (21:42 +0800)
committerYen Chi Hsuan <yan12125@gmail.com>
Sat, 30 Jan 2016 13:42:27 +0000 (21:42 +0800)
youtube_dl/extractor/common.py

index 243db71dcb34c6fe4684fb6cd2f6933e581ef2a7..f1313ef04fe926d912322081fba1a08f2bea7141 100644 (file)
@@ -1376,10 +1376,15 @@ class InfoExtractor(object):
                         full_info.update(f)
                         codecs = r.attrib.get('codecs')
                         if codecs:
-                            if full_info.get('acodec') == 'none':
-                                full_info['vcodec'] = codecs
-                            elif full_info.get('vcodec') == 'none':
-                                full_info['acodec'] = codecs
+                            if mime_type.startswith('video/'):
+                                vcodec, acodec = codecs, 'none'
+                            else:  # mime_type.startswith('audio/')
+                                vcodec, acodec = 'none', codecs
+
+                            full_info.update({
+                                'vcodec': vcodec,
+                                'acodec': acodec,
+                            })
                         formats.append(full_info)
                     else:
                         existing_format.update(f)