Browse Source

[ivi] Use centralized format sorting

totalwebcasting
Philipp Hagemeister 11 years ago
parent
commit
bf5b0a1bfb
1 changed files with 10 additions and 8 deletions
  1. +10
    -8
      youtube_dl/extractor/ivi.py

+ 10
- 8
youtube_dl/extractor/ivi.py View File

@ -84,14 +84,16 @@ class IviIE(InfoExtractor):
result = video_json[u'result'] result = video_json[u'result']
formats = [{'url': x[u'url'],
'format_id': x[u'content_format']
} for x in result[u'files'] if x[u'content_format'] in self._known_formats]
formats.sort(key=lambda fmt: self._known_formats.index(fmt['format_id']))
if len(formats) == 0:
self._downloader.report_warning(u'No media links available for %s' % video_id)
return
formats = [{
'url': x[u'url'],
'format_id': x[u'content_format'],
'preference': self._known_formats.index(x[u'content_format']),
} for x in result[u'files'] if x[u'content_format'] in self._known_formats]
self._sort_formats(formats)
if not formats:
raise ExtractorError(u'No media links available for %s' % video_id)
duration = result[u'duration'] duration = result[u'duration']
compilation = result[u'compilation'] compilation = result[u'compilation']


Loading…
Cancel
Save