mirror of
https://github.com/morpheus65535/bazarr
synced 2025-01-30 19:02:34 +00:00
Fix for Subliminal exception: 'list' object has no attribute 'lower'. This is panni's fix.
This commit is contained in:
parent
09206a91d8
commit
4dfc250287
1 changed files with 20 additions and 5 deletions
|
@ -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')
|
||||
|
|
Loading…
Reference in a new issue