diff options
author | Philipp Hagemeister <phihag@phihag.de> | 2013-12-26 18:40:09 +0100 |
---|---|---|
committer | Philipp Hagemeister <phihag@phihag.de> | 2013-12-26 18:40:16 +0100 |
commit | bf5b0a1bfb3d875cb3ccd2fc834efd7343885bd2 (patch) | |
tree | b2c6d476680ccef29619f1233dc85f5a69ecc8a0 /youtube_dl/extractor/ivi.py | |
parent | bfe9de8510d99da9803075f8bc71059bb3b3d4ed (diff) |
[ivi] Use centralized format sorting
Diffstat (limited to 'youtube_dl/extractor/ivi.py')
-rw-r--r-- | youtube_dl/extractor/ivi.py | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/youtube_dl/extractor/ivi.py b/youtube_dl/extractor/ivi.py index 4bdf55f93..98d1d272a 100644 --- a/youtube_dl/extractor/ivi.py +++ b/youtube_dl/extractor/ivi.py @@ -84,14 +84,16 @@ class IviIE(InfoExtractor): 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'] compilation = result[u'compilation'] |