diff options
author | Louis Vézina <[email protected]> | 2018-10-17 00:21:24 -0400 |
---|---|---|
committer | Louis Vézina <[email protected]> | 2018-10-17 00:21:24 -0400 |
commit | 4dfc250287aa60734588cf07ec3ba3417ac286b6 (patch) | |
tree | fbbbc1f7c16fd9ea9769a2c1b4348cdfa95473b5 /libs/subliminal | |
parent | 09206a91d8b6ac6c20dca050339a18424405c2f5 (diff) | |
download | bazarr-4dfc250287aa60734588cf07ec3ba3417ac286b6.tar.gz bazarr-4dfc250287aa60734588cf07ec3ba3417ac286b6.zip |
Fix for Subliminal exception: 'list' object has no attribute 'lower'. This is panni's fix.
Diffstat (limited to 'libs/subliminal')
-rw-r--r-- | libs/subliminal/subtitle.py | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/libs/subliminal/subtitle.py b/libs/subliminal/subtitle.py index 83beab63a..53313a7c7 100644 --- a/libs/subliminal/subtitle.py +++ b/libs/subliminal/subtitle.py @@ -6,6 +6,8 @@ import os import chardet import pysrt +import types + from .score import get_equivalent_release_groups from .video import Episode, Movie from .utils import sanitize, sanitize_release_group @@ -238,11 +240,24 @@ def guess_matches(video, guess, partial=False): if video.resolution and 'screen_size' in guess and guess['screen_size'] == video.resolution: matches.add('resolution') # format - # 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') + if 'format' in guess: + formats = guess["format"] + if not isinstance(formats, types.ListType): + formats = [formats] + + if video.format: + video_format = video.format + if video_format in ("HDTV", "SDTV", "TV"): + video_format = "TV" + logger.debug("Treating HDTV/SDTV the same") + + for frmt in formats: + if frmt in ("HDTV", "SDTV"): + frmt = "TV" + + if frmt.lower() == video_format.lower(): + matches.add('format') + break # video_codec if video.video_codec and 'video_codec' in guess and guess['video_codec'] == video.video_codec: matches.add('video_codec') |