mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-09-10 00:58:17 +02:00
[FormatSort] Fix for when some formats have quality and others don't
This commit is contained in:
parent
88728713c8
commit
6a04a74e8b
@ -1439,7 +1439,7 @@ class FormatSort:
|
|||||||
'hasvid': {'priority': True, 'field': 'vcodec', 'type': 'boolean', 'not_in_list': ('none',)},
|
'hasvid': {'priority': True, 'field': 'vcodec', 'type': 'boolean', 'not_in_list': ('none',)},
|
||||||
'hasaud': {'field': 'acodec', 'type': 'boolean', 'not_in_list': ('none',)},
|
'hasaud': {'field': 'acodec', 'type': 'boolean', 'not_in_list': ('none',)},
|
||||||
'lang': {'priority': True, 'convert': 'ignore', 'field': 'language_preference'},
|
'lang': {'priority': True, 'convert': 'ignore', 'field': 'language_preference'},
|
||||||
'quality': {'convert': 'float_none'},
|
'quality': {'convert': 'float_none', 'default': -1},
|
||||||
'filesize': {'convert': 'bytes'},
|
'filesize': {'convert': 'bytes'},
|
||||||
'fs_approx': {'convert': 'bytes', 'field': 'filesize_approx'},
|
'fs_approx': {'convert': 'bytes', 'field': 'filesize_approx'},
|
||||||
'id': {'convert': 'string', 'field': 'format_id'},
|
'id': {'convert': 'string', 'field': 'format_id'},
|
||||||
@ -1621,7 +1621,7 @@ def _calculate_field_preference_from_value(self, format, field, type, value):
|
|||||||
value = self._resolve_field_value(field, value, True)
|
value = self._resolve_field_value(field, value, True)
|
||||||
|
|
||||||
# try to convert to number
|
# try to convert to number
|
||||||
val_num = float_or_none(value)
|
val_num = float_or_none(value, default=self._get_field_setting(field, 'default'))
|
||||||
is_num = self._get_field_setting(field, 'convert') != 'string' and val_num is not None
|
is_num = self._get_field_setting(field, 'convert') != 'string' and val_num is not None
|
||||||
if is_num:
|
if is_num:
|
||||||
value = val_num
|
value = val_num
|
||||||
|
Loading…
Reference in New Issue
Block a user