mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-11-18 15:35:14 +00:00
[formatsort] Remove forced priority of quality
When making `FormatSort`, I misinterpreted the purpose `quality`
This commit is contained in:
@@ -2716,8 +2716,6 @@ class YoutubeDL(object):
|
||||
if f.get('preference') is None or f['preference'] >= -1000]
|
||||
header_line = ['format code', 'extension', 'resolution', 'note']
|
||||
|
||||
# if len(formats) > 1:
|
||||
# table[-1][-1] += (' ' if table[-1][-1] else '') + '(best)'
|
||||
self.to_screen(
|
||||
'[info] Available formats for %s:\n%s' % (info_dict['id'], render_table(
|
||||
header_line,
|
||||
|
||||
@@ -168,7 +168,9 @@ class ArteTVIE(ArteTVBaseIE):
|
||||
|
||||
formats.append(format)
|
||||
|
||||
self._sort_formats(formats)
|
||||
# For this extractor, quality only represents the relative quality
|
||||
# with respect to other formats with the same resolution
|
||||
self._sort_formats(formats, ('res', 'quality'))
|
||||
|
||||
return {
|
||||
'id': player_info.get('VID') or video_id,
|
||||
|
||||
@@ -1388,7 +1388,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': {'priority': True, 'convert': 'float_none'},
|
||||
'quality': {'convert': 'float_none'},
|
||||
'filesize': {'convert': 'bytes'},
|
||||
'fs_approx': {'convert': 'bytes', 'field': 'filesize_approx'},
|
||||
'id': {'convert': 'string', 'field': 'format_id'},
|
||||
|
||||
@@ -32,7 +32,7 @@ from ..utils import (
|
||||
mimetype2ext,
|
||||
parse_codecs,
|
||||
parse_duration,
|
||||
# qualities, # TODO: Enable this after fixing formatSort
|
||||
qualities,
|
||||
remove_start,
|
||||
smuggle_url,
|
||||
str_or_none,
|
||||
@@ -1528,8 +1528,7 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
|
||||
itags = []
|
||||
itag_qualities = {}
|
||||
player_url = None
|
||||
# TODO: Enable this after fixing formatSort
|
||||
# q = qualities(['tiny', 'small', 'medium', 'large', 'hd720', 'hd1080', 'hd1440', 'hd2160', 'hd2880', 'highres'])
|
||||
q = qualities(['tiny', 'small', 'medium', 'large', 'hd720', 'hd1080', 'hd1440', 'hd2160', 'hd2880', 'highres'])
|
||||
streaming_data = player_response.get('streamingData') or {}
|
||||
streaming_formats = streaming_data.get('formats') or []
|
||||
streaming_formats.extend(streaming_data.get('adaptiveFormats') or [])
|
||||
@@ -1577,7 +1576,7 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
|
||||
'format_note': fmt.get('qualityLabel') or quality,
|
||||
'fps': int_or_none(fmt.get('fps')),
|
||||
'height': int_or_none(fmt.get('height')),
|
||||
# 'quality': q(quality), # TODO: Enable this after fixing formatSort
|
||||
'quality': q(quality),
|
||||
'tbr': tbr,
|
||||
'url': fmt_url,
|
||||
'width': fmt.get('width'),
|
||||
@@ -1620,8 +1619,11 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
|
||||
itag = f['format_id']
|
||||
if itag in itags:
|
||||
continue
|
||||
# if itag in itag_qualities: # TODO: Enable this after fixing formatSort
|
||||
# f['quality'] = q(itag_qualities[itag])
|
||||
if itag in itag_qualities:
|
||||
# Not actually usefull since the sorting is already done with "quality,res,fps,codec"
|
||||
# but kept to maintain feature parity (and code similarity) with youtube-dl
|
||||
# Remove if this causes any issues with sorting in future
|
||||
f['quality'] = q(itag_qualities[itag])
|
||||
filesize = int_or_none(self._search_regex(
|
||||
r'/clen/(\d+)', f.get('fragment_base_url')
|
||||
or f['url'], 'file size', default=None))
|
||||
|
||||
Reference in New Issue
Block a user