Fix for guessit returning a list for format

pull/191/head
Louis Vézina 6 years ago
parent 80eaa7a21e
commit bb85224826

@ -238,7 +238,10 @@ def guess_matches(video, guess, partial=False):
if video.resolution and 'screen_size' in guess and guess['screen_size'] == video.resolution: if video.resolution and 'screen_size' in guess and guess['screen_size'] == video.resolution:
matches.add('resolution') matches.add('resolution')
# format # format
if video.format and 'format' in guess and guess['format'].lower() == video.format.lower(): # Guessit may return a list for `format`, which indicates a conflict in the guessing.
# We should match `format` only when it returns single value to avoid false `format` matches
if video.format and guess.get('format') and not isinstance(guess['format'], list) \
and guess['format'].lower() == video.format.lower():
matches.add('format') matches.add('format')
# video_codec # video_codec
if video.video_codec and 'video_codec' in guess and guess['video_codec'] == video.video_codec: if video.video_codec and 'video_codec' in guess and guess['video_codec'] == video.video_codec:

Loading…
Cancel
Save