[YoutubeDL] check only for None Value in thumbnails sorting

pull/10424/head
Remita Amine 2016-08-25 11:53:47 +01:00
parent 5c13c28566
commit d37708fc86
1 changed files with 4 additions and 2 deletions

View File

@ -1256,8 +1256,10 @@ class YoutubeDL(object):
info_dict['thumbnails'] = thumbnails = [{'url': thumbnail}] info_dict['thumbnails'] = thumbnails = [{'url': thumbnail}]
if thumbnails: if thumbnails:
thumbnails.sort(key=lambda t: ( thumbnails.sort(key=lambda t: (
t.get('preference') or -1, t.get('width') or -1, t.get('height') or -1, t.get('preference') if t.get('preference') is not None else -1,
t.get('id') or '', t.get('url'))) t.get('width') if t.get('width') is not None else -1,
t.get('height') if t.get('height') is not None else -1,
t.get('id') if t.get('id') is not None else '', t.get('url')))
for i, t in enumerate(thumbnails): for i, t in enumerate(thumbnails):
t['url'] = sanitize_url(t['url']) t['url'] = sanitize_url(t['url'])
if t.get('width') and t.get('height'): if t.get('width') and t.get('height'):