mirror of
https://github.com/mxpv/podsync.git
synced 2024-05-11 05:55:04 +00:00
Fix ytdl sorting for episods without 'filesize' field
This commit is contained in:
@ -83,9 +83,9 @@ def _choose_url(info, metadata):
|
||||
|
||||
# Sort list by field (width for videos, file size for audio)
|
||||
sort_field = 'width' if is_video else 'filesize'
|
||||
ordered = sorted(fmt_list, key=lambda x: x[sort_field], reverse=True)
|
||||
ordered = sorted(fmt_list, key=lambda x: x[sort_field] or x['format_id'], reverse=True)
|
||||
|
||||
# Choose an item depending on quality
|
||||
# Choose an item depending on quality, better at the beginning
|
||||
is_high_quality = metadata['quality'] == 'high'
|
||||
item = ordered[0] if is_high_quality else ordered[-1]
|
||||
return item['url']
|
||||
|
Reference in New Issue
Block a user