summaryrefslogtreecommitdiffhomepage
path: root/libs/subliminal
diff options
context:
space:
mode:
authorpanni <[email protected]>2018-10-31 17:02:33 +0100
committerpanni <[email protected]>2018-10-31 17:02:33 +0100
commit4beaeaa99e84bbe1ed87d0466a55a22ba25c8437 (patch)
tree2ce14828979206f4aa7db3880d224989fd4fe98c /libs/subliminal
parentd61bdfcd4fe2d4423d784cd1370acf630719e90f (diff)
parent9ea3a4f257736d1369db8b09c3d2c1e1b20fe2f4 (diff)
downloadbazarr-4beaeaa99e84bbe1ed87d0466a55a22ba25c8437.tar.gz
bazarr-4beaeaa99e84bbe1ed87d0466a55a22ba25c8437.zip
Merge remote-tracking branch 'origin/development' into subliminal_patch
# Conflicts: # libs/subliminal/subtitle.py
Diffstat (limited to 'libs/subliminal')
-rw-r--r--libs/subliminal/subtitle.py17
1 files changed, 15 insertions, 2 deletions
diff --git a/libs/subliminal/subtitle.py b/libs/subliminal/subtitle.py
index 726b28e37..b78733fb5 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,8 +240,19 @@ 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
- if video.format and 'format' in guess and guess['format'].lower() == video.format.lower():
- matches.add('format')
+ if 'format' in guess and video.format:
+ formats = guess["format"]
+ if not isinstance(formats, types.ListType):
+ formats = [formats]
+
+ video_formats = video.format
+ if not isinstance(video_formats, types.ListType):
+ video_formats = [video_formats]
+
+ lwr = lambda x: "tv" if x in ("HDTV", "SDTV", "TV") else x.lower()
+
+ if set(list(map(lwr, formats))) & set(list(map(lwr, video_formats))):
+ matches.add('format')
# video_codec
if video.video_codec and 'video_codec' in guess and guess['video_codec'] == video.video_codec:
matches.add('video_codec')