[blinkx] Use centralized format sorting

This commit is contained in:
Philipp Hagemeister 2013-12-26 21:05:30 +01:00
parent bf5b0a1bfb
commit 4bc60dafeb

View file

@ -61,9 +61,10 @@ def _real_extract(self, url):
elif m['type'] in ('flv', 'mp4'):
vcodec = remove_start(m['vcodec'], 'ff')
acodec = remove_start(m['acodec'], 'ff')
tbr = (int(m['vbr']) + int(m['abr'])) // 1000
format_id = (u'%s-%sk-%s' %
(vcodec,
(int(m['vbr']) + int(m['abr'])) // 1000,
tbr,
m['w']))
formats.append({
'format_id': format_id,
@ -72,10 +73,12 @@ def _real_extract(self, url):
'acodec': acodec,
'abr': int(m['abr']) // 1000,
'vbr': int(m['vbr']) // 1000,
'tbr': tbr,
'width': int(m['w']),
'height': int(m['h']),
})
formats.sort(key=lambda f: (f['width'], f['vbr'], f['abr']))
self._sort_formats(formats)
return {
'id': display_id,