Browse Source

[YoutubeDL] Calculate thumbnail IDs automatically

totalwebcasting
Philipp Hagemeister 10 years ago
parent
commit
f6c24009be
1 changed files with 3 additions and 1 deletions
  1. +3
    -1
      youtube_dl/YoutubeDL.py

+ 3
- 1
youtube_dl/YoutubeDL.py View File

@ -964,9 +964,11 @@ class YoutubeDL(object):
thumbnails.sort(key=lambda t: (
t.get('preference'), t.get('width'), t.get('height'),
t.get('id'), t.get('url')))
for t in thumbnails:
for i, t in enumerate(thumbnails):
if 'width' in t and 'height' in t:
t['resolution'] = '%dx%d' % (t['width'], t['height'])
if t.get('id') is None:
t['id'] = '%d' % i
if thumbnails and 'thumbnail' not in info_dict:
info_dict['thumbnail'] = thumbnails[-1]['url']


Loading…
Cancel
Save