aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/YoutubeDL.py
diff options
context:
space:
mode:
authorPhilipp Hagemeister <phihag@phihag.de>2015-02-03 10:52:22 +0100
committerPhilipp Hagemeister <phihag@phihag.de>2015-02-03 10:52:22 +0100
commitf6c24009bea95104e186afd77a867abbc61b7f81 (patch)
tree96bdab22b3800e6d6b8160001dcdee1389cb3e14 /youtube_dl/YoutubeDL.py
parentd86204230157fc7a8a6800b7b814e8e3bbfbdf20 (diff)
[YoutubeDL] Calculate thumbnail IDs automatically
Diffstat (limited to 'youtube_dl/YoutubeDL.py')
-rwxr-xr-xyoutube_dl/YoutubeDL.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/youtube_dl/YoutubeDL.py b/youtube_dl/YoutubeDL.py
index c18ce9660..1730df4cd 100755
--- a/youtube_dl/YoutubeDL.py
+++ b/youtube_dl/YoutubeDL.py
@@ -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']