mirror of
https://github.com/morpheus65535/bazarr
synced 2024-12-23 16:23:41 +00:00
Fix for multiple format in filename.
This commit is contained in:
parent
0fac16c432
commit
37142e247e
1 changed files with 11 additions and 23 deletions
|
@ -232,39 +232,27 @@ def guess_matches(video, guess, partial=False):
|
||||||
if video.title and 'title' in guess and sanitize(guess['title']) == sanitize(video.title):
|
if video.title and 'title' in guess and sanitize(guess['title']) == sanitize(video.title):
|
||||||
matches.add('title')
|
matches.add('title')
|
||||||
# release_group
|
# release_group
|
||||||
if 'release_group' in guess:
|
if (video.release_group and 'release_group' in guess and
|
||||||
release_groups = guess["release_group"]
|
sanitize_release_group(guess['release_group']) in
|
||||||
if not isinstance(release_groups, types.ListType):
|
|
||||||
release_groups = [release_groups]
|
|
||||||
|
|
||||||
if video.release_group:
|
|
||||||
for release_group in release_groups:
|
|
||||||
if (sanitize_release_group(release_group) in
|
|
||||||
get_equivalent_release_groups(sanitize_release_group(video.release_group))):
|
get_equivalent_release_groups(sanitize_release_group(video.release_group))):
|
||||||
matches.add('release_group')
|
matches.add('release_group')
|
||||||
break
|
|
||||||
# resolution
|
# resolution
|
||||||
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 'format' in guess:
|
if 'format' in guess and video.format:
|
||||||
formats = guess["format"]
|
formats = guess["format"]
|
||||||
if not isinstance(formats, types.ListType):
|
if not isinstance(formats, types.ListType):
|
||||||
formats = [formats]
|
formats = [formats]
|
||||||
|
|
||||||
if video.format:
|
video_formats = video.format
|
||||||
video_format = video.format
|
if not isinstance(video_formats, types.ListType):
|
||||||
if video_format in ("HDTV", "SDTV", "TV"):
|
video_formats = [video_formats]
|
||||||
video_format = "TV"
|
|
||||||
logger.debug("Treating HDTV/SDTV the same")
|
|
||||||
|
|
||||||
for frmt in formats:
|
lwr = lambda x: "tv" if x in ("HDTV", "SDTV", "TV") else x.lower()
|
||||||
if frmt in ("HDTV", "SDTV"):
|
|
||||||
frmt = "TV"
|
|
||||||
|
|
||||||
if frmt.lower() == video_format.lower():
|
if set(list(map(lwr, formats))) & set(list(map(lwr, video_formats))):
|
||||||
matches.add('format')
|
matches.add('format')
|
||||||
break
|
|
||||||
# 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:
|
||||||
matches.add('video_codec')
|
matches.add('video_codec')
|
||||||
|
|
Loading…
Reference in a new issue