Rename option to --thumbnail-format

This commit is contained in:
7x11x13 2024-12-24 11:47:18 -05:00
parent 9c99de6d9b
commit afe35b43fa
3 changed files with 7 additions and 7 deletions

View file

@ -291,7 +291,7 @@ class YoutubeDL:
unless writeinfojson is also given unless writeinfojson is also given
writeannotations: Write the video annotations to a .annotations.xml file writeannotations: Write the video annotations to a .annotations.xml file
writethumbnail: Write the thumbnail image to a file writethumbnail: Write the thumbnail image to a file
thumbnail_id: ID of thumbnail to write thumbnail_format: Format code of thumbnail to write
allow_playlist_files: Whether to write playlists' description, infojson etc allow_playlist_files: Whether to write playlists' description, infojson etc
also to disk when using the 'write*' options also to disk when using the 'write*' options
write_all_thumbnails: Write all thumbnail formats to files write_all_thumbnails: Write all thumbnail formats to files
@ -2606,7 +2606,7 @@ class YoutubeDL:
def _sort_thumbnails(self, thumbnails): def _sort_thumbnails(self, thumbnails):
thumbnails.sort(key=lambda t: ( thumbnails.sort(key=lambda t: (
t.get('id') == self.params.get('thumbnail_id') if t.get('id') is not None else False, t.get('id') == self.params.get('thumbnail_format') if t.get('id') is not None else False,
t.get('preference') if t.get('preference') is not None else -1, t.get('preference') if t.get('preference') is not None else -1,
t.get('width') if t.get('width') is not None else -1, 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('height') if t.get('height') is not None else -1,
@ -2632,7 +2632,7 @@ class YoutubeDL:
continue continue
yield t yield t
thumbnail_id = self.params.get('thumbnail_id') thumbnail_id = self.params.get('thumbnail_format')
if thumbnail_id and thumbnail_id not in [t.get('id') for t in thumbnails]: if thumbnail_id and thumbnail_id not in [t.get('id') for t in thumbnails]:
self.raise_no_formats(info_dict, msg=( self.raise_no_formats(info_dict, msg=(
'Invalid thumbnail ID specified. ' 'Invalid thumbnail ID specified. '

View file

@ -870,7 +870,7 @@ def parse_options(argv=None):
'clean_infojson': opts.clean_infojson, 'clean_infojson': opts.clean_infojson,
'getcomments': opts.getcomments, 'getcomments': opts.getcomments,
'writethumbnail': opts.writethumbnail is True, 'writethumbnail': opts.writethumbnail is True,
'thumbnail_id': opts.thumbnail_id, 'thumbnail_format': opts.thumbnail_format,
'write_all_thumbnails': opts.writethumbnail == 'all', 'write_all_thumbnails': opts.writethumbnail == 'all',
'writelink': opts.writelink, 'writelink': opts.writelink,
'writeurllink': opts.writeurllink, 'writeurllink': opts.writeurllink,

View file

@ -1525,9 +1525,9 @@ def create_parser():
action='store_false', dest='writethumbnail', action='store_false', dest='writethumbnail',
help='Do not write thumbnail image to disk (default)') help='Do not write thumbnail image to disk (default)')
thumbnail.add_option( thumbnail.add_option(
'--thumbnail-id', '--thumbnail-format',
metavar='ID', dest='thumbnail_id', metavar='format', dest='thumbnail_format',
help='ID of thumbnail to write to disk') help='Format code of thumbnail to write to disk')
thumbnail.add_option( thumbnail.add_option(
'--write-all-thumbnails', '--write-all-thumbnails',
action='store_const', dest='writethumbnail', const='all', action='store_const', dest='writethumbnail', const='all',