1
0
mirror of https://codeberg.org/polarisfm/youtube-dl synced 2024-11-26 18:34:32 +01:00

[channel 9] Use centralized format sorting

This commit is contained in:
Philipp Hagemeister 2013-12-26 21:14:43 +01:00
parent 12c978739a
commit a1b92edbb3

View File

@ -76,14 +76,18 @@ class Channel9IE(InfoExtractor):
</div>)? # File size part may be missing </div>)? # File size part may be missing
''' '''
# Extract known formats # Extract known formats
formats = [{'url': x.group('url'), formats = [{
'format_id': x.group('quality'), 'url': x.group('url'),
'format_note': x.group('note'), 'format_id': x.group('quality'),
'format': '%s (%s)' % (x.group('quality'), x.group('note')), 'format_note': x.group('note'),
'filesize': self._restore_bytes(x.group('filesize')), # File size is approximate 'format': u'%s (%s)' % (x.group('quality'), x.group('note')),
} for x in list(re.finditer(FORMAT_REGEX, html)) if x.group('quality') in self._known_formats] 'filesize': self._restore_bytes(x.group('filesize')), # File size is approximate
# Sort according to known formats list 'preference': self._known_formats.index(x.group('quality')),
formats.sort(key=lambda fmt: self._known_formats.index(fmt['format_id'])) 'vcodec': 'none' if x.group('note') == 'Audio only' else None,
} for x in list(re.finditer(FORMAT_REGEX, html)) if x.group('quality') in self._known_formats]
self._sort_formats(formats)
return formats return formats
def _extract_title(self, html): def _extract_title(self, html):