watch: determine video source based on quality, not actual height

For some phone videos, the dimensions of the video might be
e.g. 360x640 instead of 640x360, which would be compared as
though it was "640p", and thus no source would be chosen
if default quality is 360p. Use the 'quality' entry which will
always be 360 for that quality.

Signed-off-by: Jesús <heckyel@hyperbola.info>
This commit is contained in:
James Taylor
2021-08-03 12:58:24 -07:00
committed by Jesús
parent c62293c5cb
commit 7720f3bde5

View File

@@ -29,7 +29,8 @@ def get_video_sources(info):
for fmt in info['formats']:
if not all(fmt[attr] for attr in ('quality', 'width', 'ext', 'url')):
continue
if fmt['acodec'] and fmt['vcodec'] and fmt['height'] <= max_resolution:
if (fmt['acodec'] and fmt['vcodec']
and fmt['quality'] <= max_resolution):
video_sources.append({
'src': fmt['url'],
'type': 'video/' + fmt['ext'],