From 6a04a74e8b4e45b9699f5a990007db50e8e5a34b Mon Sep 17 00:00:00 2001 From: pukkandan Date: Mon, 26 Apr 2021 10:45:17 +0530 Subject: [PATCH] [FormatSort] Fix for when some formats have quality and others don't --- yt_dlp/extractor/common.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/yt_dlp/extractor/common.py b/yt_dlp/extractor/common.py index 9ead6db2d..4487c5375 100644 --- a/yt_dlp/extractor/common.py +++ b/yt_dlp/extractor/common.py @@ -1439,7 +1439,7 @@ class InfoExtractor(object): 'hasvid': {'priority': True, 'field': 'vcodec', 'type': 'boolean', 'not_in_list': ('none',)}, 'hasaud': {'field': 'acodec', 'type': 'boolean', 'not_in_list': ('none',)}, 'lang': {'priority': True, 'convert': 'ignore', 'field': 'language_preference'}, - 'quality': {'convert': 'float_none'}, + 'quality': {'convert': 'float_none', 'default': -1}, 'filesize': {'convert': 'bytes'}, 'fs_approx': {'convert': 'bytes', 'field': 'filesize_approx'}, 'id': {'convert': 'string', 'field': 'format_id'}, @@ -1621,7 +1621,7 @@ class InfoExtractor(object): value = self._resolve_field_value(field, value, True) # 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 if is_num: value = val_num