[extractor/common] detect f4m audio only formats

This commit is contained in:
Remita Amine 2016-10-19 14:42:48 +01:00
parent 791d29dbf8
commit edd6074cea

View file

@ -1100,6 +1100,13 @@ def _parse_f4m_formats(self, manifest, manifest_url, video_id, preference=None,
manifest, ['{http://ns.adobe.com/f4m/1.0}bootstrapInfo', '{http://ns.adobe.com/f4m/2.0}bootstrapInfo'], manifest, ['{http://ns.adobe.com/f4m/1.0}bootstrapInfo', '{http://ns.adobe.com/f4m/2.0}bootstrapInfo'],
'bootstrap info', default=None) 'bootstrap info', default=None)
vcodec = None
mime_type = xpath_text(
manifest, ['{http://ns.adobe.com/f4m/1.0}mimeType', '{http://ns.adobe.com/f4m/2.0}mimeType'],
'base URL', default=None)
if mime_type and mime_type.startswith('audio/'):
vcodec = 'none'
for i, media_el in enumerate(media_nodes): for i, media_el in enumerate(media_nodes):
tbr = int_or_none(media_el.attrib.get('bitrate')) tbr = int_or_none(media_el.attrib.get('bitrate'))
width = int_or_none(media_el.attrib.get('width')) width = int_or_none(media_el.attrib.get('width'))
@ -1140,6 +1147,7 @@ def _parse_f4m_formats(self, manifest, manifest_url, video_id, preference=None,
'width': f.get('width') or width, 'width': f.get('width') or width,
'height': f.get('height') or height, 'height': f.get('height') or height,
'format_id': f.get('format_id') if not tbr else format_id, 'format_id': f.get('format_id') if not tbr else format_id,
'vcodec': vcodec,
}) })
formats.extend(f4m_formats) formats.extend(f4m_formats)
continue continue
@ -1156,6 +1164,7 @@ def _parse_f4m_formats(self, manifest, manifest_url, video_id, preference=None,
'tbr': tbr, 'tbr': tbr,
'width': width, 'width': width,
'height': height, 'height': height,
'vcodec': vcodec,
'preference': preference, 'preference': preference,
}) })
return formats return formats