mirror of
https://github.com/meeb/tubesync.git
synced 2025-06-24 14:06:36 +00:00
Return for empty format lists first
This commit is contained in:
parent
6d7d3483a4
commit
09044aa95d
@ -57,10 +57,10 @@ def get_best_audio_format(media):
|
|||||||
if not fmt['acodec']:
|
if not fmt['acodec']:
|
||||||
continue
|
continue
|
||||||
audio_formats.append(fmt)
|
audio_formats.append(fmt)
|
||||||
audio_formats = list(reversed(audio_formats))
|
|
||||||
if not audio_formats:
|
if not audio_formats:
|
||||||
# Media has no audio formats at all
|
# Media has no audio formats at all
|
||||||
return False, False
|
return False, False
|
||||||
|
audio_formats = list(reversed(audio_formats))
|
||||||
# Find the first audio format with a matching codec
|
# Find the first audio format with a matching codec
|
||||||
for fmt in audio_formats:
|
for fmt in audio_formats:
|
||||||
if media.source.source_acodec == fmt['acodec']:
|
if media.source.source_acodec == fmt['acodec']:
|
||||||
@ -113,12 +113,12 @@ def get_best_video_format(media):
|
|||||||
else:
|
else:
|
||||||
# Can't fallback
|
# Can't fallback
|
||||||
return False, False
|
return False, False
|
||||||
video_formats = multi_key_sort(video_formats, sort_keys, True)
|
|
||||||
source_resolution = media.source.source_resolution.strip().upper()
|
|
||||||
source_vcodec = media.source.source_vcodec
|
|
||||||
if not video_formats:
|
if not video_formats:
|
||||||
# Still no matches
|
# Still no matches
|
||||||
return False, False
|
return False, False
|
||||||
|
video_formats = multi_key_sort(video_formats, sort_keys, True)
|
||||||
|
source_resolution = media.source.source_resolution.strip().upper()
|
||||||
|
source_vcodec = media.source.source_vcodec
|
||||||
exact_match, best_match = None, None
|
exact_match, best_match = None, None
|
||||||
# Of our filtered video formats, check for resolution + codec + hdr + fps match
|
# Of our filtered video formats, check for resolution + codec + hdr + fps match
|
||||||
if media.source.prefer_60fps and media.source.prefer_hdr:
|
if media.source.prefer_60fps and media.source.prefer_hdr:
|
||||||
|
Loading…
Reference in New Issue
Block a user