Add temporary _sort_formats helper function

This commit is contained in:
Philipp Hagemeister 2013-12-24 12:25:22 +01:00
parent f49d89ee04
commit 4bcc7bd1f2
3 changed files with 44 additions and 21 deletions

View file

@ -1433,16 +1433,7 @@ class YoutubeIE(YoutubeBaseInfoExtractor, SubtitlesInfoExtractor):
'format_note': note,
})
def _formats_key(f):
note = f.get('format_note')
if note is None:
note = u''
is_dash = u'DASH' in note
return (
0 if is_dash else 1,
f.get('height') if f.get('height') is not None else -1,
f.get('width') if f.get('width') is not None else -1)
formats.sort(key=_formats_key)
self._sort_formats(formats)
return {
'id': video_id,