1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2025-12-06 00:05:31 +00:00

[formatsort] Remove misuse of 'preference'

'preference' is to be used only when the format is better that ALL qualities of a lower preference irrespective of ANY sorting order the user requests. See deezer.py for correct use of this

In the older sorting method, `preference`, `quality` and `language_preference` were functionally almost equivalent. So these disparities doesn't really matter there

Also, despite what the documentation says, the default for `preference` was actually 0 and not -1. I have tried to correct this and also account for it when converting `preference` to `quality`
This commit is contained in:
pukkandan
2021-02-19 03:33:16 +05:30
parent dca3ff4a5e
commit f983b87567
61 changed files with 89 additions and 108 deletions

View File

@@ -87,7 +87,7 @@ class CoubIE(InfoExtractor):
'filesize': int_or_none(item.get('size')),
'vcodec': 'none' if kind == 'audio' else None,
'quality': quality_key(quality),
'preference': preference_key(HTML5),
'source_preference': preference_key(HTML5),
})
iphone_url = file_versions.get(IPHONE, {}).get('url')
@@ -95,7 +95,7 @@ class CoubIE(InfoExtractor):
formats.append({
'url': iphone_url,
'format_id': IPHONE,
'preference': preference_key(IPHONE),
'source_preference': preference_key(IPHONE),
})
mobile_url = file_versions.get(MOBILE, {}).get('audio_url')
@@ -103,7 +103,7 @@ class CoubIE(InfoExtractor):
formats.append({
'url': mobile_url,
'format_id': '%s-audio' % MOBILE,
'preference': preference_key(MOBILE),
'source_preference': preference_key(MOBILE),
})
self._sort_formats(formats)