0
0
Fork 0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2024-11-16 01:25:06 +00:00

[arte] Fix versionCode interpretation (#2588)

This commit is contained in:
Philipp Hagemeister 2014-05-08 02:00:01 +02:00
parent bebd6f9308
commit 5c9f3b8b16

View file

@ -121,14 +121,17 @@ def sort_key(f):
return ['HQ', 'MQ', 'EQ', 'SQ'].index(f['quality']) return ['HQ', 'MQ', 'EQ', 'SQ'].index(f['quality'])
else: else:
def sort_key(f): def sort_key(f):
versionCode = f.get('versionCode')
if versionCode is None:
versionCode = ''
return ( return (
# Sort first by quality # Sort first by quality
int(f.get('height',-1)), int(f.get('height', -1)),
int(f.get('bitrate',-1)), int(f.get('bitrate', -1)),
# The original version with subtitles has lower relevance # The original version with subtitles has lower relevance
re.match(r'VO-ST(F|A)', f.get('versionCode', '')) is None, re.match(r'VO-ST(F|A)', versionCode) is None,
# The version with sourds/mal subtitles has also lower relevance # The version with sourds/mal subtitles has also lower relevance
re.match(r'VO?(F|A)-STM\1', f.get('versionCode', '')) is None, re.match(r'VO?(F|A)-STM\1', versionCode) is None,
# Prefer http downloads over m3u8 # Prefer http downloads over m3u8
0 if f['url'].endswith('m3u8') else 1, 0 if f['url'].endswith('m3u8') else 1,
) )