mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-27 15:16:52 +01:00
Parse resolution in info dictionary (#173)
This commit is contained in:
parent
4690688658
commit
3561530776
@ -1644,7 +1644,7 @@ def _merge(formats_pair):
|
|||||||
new_dict.update({
|
new_dict.update({
|
||||||
'width': the_only_video.get('width'),
|
'width': the_only_video.get('width'),
|
||||||
'height': the_only_video.get('height'),
|
'height': the_only_video.get('height'),
|
||||||
'resolution': the_only_video.get('resolution'),
|
'resolution': the_only_video.get('resolution') or self.format_resolution(the_only_video),
|
||||||
'fps': the_only_video.get('fps'),
|
'fps': the_only_video.get('fps'),
|
||||||
'vcodec': the_only_video.get('vcodec'),
|
'vcodec': the_only_video.get('vcodec'),
|
||||||
'vbr': the_only_video.get('vbr'),
|
'vbr': the_only_video.get('vbr'),
|
||||||
@ -2651,12 +2651,11 @@ def format_resolution(format, default='unknown'):
|
|||||||
return 'audio only'
|
return 'audio only'
|
||||||
if format.get('resolution') is not None:
|
if format.get('resolution') is not None:
|
||||||
return format['resolution']
|
return format['resolution']
|
||||||
if format.get('height') is not None:
|
if format.get('width') and format.get('height'):
|
||||||
if format.get('width') is not None:
|
res = '%dx%d' % (format['width'], format['height'])
|
||||||
res = '%sx%s' % (format['width'], format['height'])
|
elif format.get('height'):
|
||||||
else:
|
res = '%sp' % format['height']
|
||||||
res = '%sp' % format['height']
|
elif format.get('width'):
|
||||||
elif format.get('width') is not None:
|
|
||||||
res = '%dx?' % format['width']
|
res = '%dx?' % format['width']
|
||||||
else:
|
else:
|
||||||
res = default
|
res = default
|
||||||
|
Loading…
Reference in New Issue
Block a user