mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-07 11:42:43 +01:00
[YoutubeDL] check for --list-thumbnails immediately after processing them
This commit is contained in:
parent
f6f6217a98
commit
b7b72db9ad
@ -1234,6 +1234,10 @@ def process_video_result(self, info_dict, download=True):
|
|||||||
if t.get('id') is None:
|
if t.get('id') is None:
|
||||||
t['id'] = '%d' % i
|
t['id'] = '%d' % i
|
||||||
|
|
||||||
|
if self.params.get('list_thumbnails'):
|
||||||
|
self.list_thumbnails(info_dict)
|
||||||
|
return
|
||||||
|
|
||||||
if thumbnails and 'thumbnail' not in info_dict:
|
if thumbnails and 'thumbnail' not in info_dict:
|
||||||
info_dict['thumbnail'] = thumbnails[-1]['url']
|
info_dict['thumbnail'] = thumbnails[-1]['url']
|
||||||
|
|
||||||
@ -1335,9 +1339,6 @@ def process_video_result(self, info_dict, download=True):
|
|||||||
if self.params.get('listformats'):
|
if self.params.get('listformats'):
|
||||||
self.list_formats(info_dict)
|
self.list_formats(info_dict)
|
||||||
return
|
return
|
||||||
if self.params.get('list_thumbnails'):
|
|
||||||
self.list_thumbnails(info_dict)
|
|
||||||
return
|
|
||||||
|
|
||||||
req_format = self.params.get('format')
|
req_format = self.params.get('format')
|
||||||
if req_format is None:
|
if req_format is None:
|
||||||
@ -1901,12 +1902,7 @@ def list_formats(self, info_dict):
|
|||||||
def list_thumbnails(self, info_dict):
|
def list_thumbnails(self, info_dict):
|
||||||
thumbnails = info_dict.get('thumbnails')
|
thumbnails = info_dict.get('thumbnails')
|
||||||
if not thumbnails:
|
if not thumbnails:
|
||||||
tn_url = info_dict.get('thumbnail')
|
self.to_screen('[info] No thumbnails present for %s' % info_dict['id'])
|
||||||
if tn_url:
|
|
||||||
thumbnails = [{'id': '0', 'url': tn_url}]
|
|
||||||
else:
|
|
||||||
self.to_screen(
|
|
||||||
'[info] No thumbnails present for %s' % info_dict['id'])
|
|
||||||
return
|
return
|
||||||
|
|
||||||
self.to_screen(
|
self.to_screen(
|
||||||
|
Loading…
Reference in New Issue
Block a user