mirror of
https://github.com/morpheus65535/bazarr
synced 2024-12-23 08:13:14 +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):
|
||||
matches.add('title')
|
||||
# release_group
|
||||
if 'release_group' in guess:
|
||||
release_groups = guess["release_group"]
|
||||
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))):
|
||||
matches.add('release_group')
|
||||
break
|
||||
if (video.release_group and 'release_group' in guess and
|
||||
sanitize_release_group(guess['release_group']) in
|
||||
get_equivalent_release_groups(sanitize_release_group(video.release_group))):
|
||||
matches.add('release_group')
|
||||
# resolution
|
||||
if video.resolution and 'screen_size' in guess and guess['screen_size'] == video.resolution:
|
||||
matches.add('resolution')
|
||||
# format
|
||||
if 'format' in guess:
|
||||
if 'format' in guess and video.format:
|
||||
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")
|
||||
video_formats = video.format
|
||||
if not isinstance(video_formats, types.ListType):
|
||||
video_formats = [video_formats]
|
||||
|
||||
for frmt in formats:
|
||||
if frmt in ("HDTV", "SDTV"):
|
||||
frmt = "TV"
|
||||
lwr = lambda x: "tv" if x in ("HDTV", "SDTV", "TV") else x.lower()
|
||||
|
||||
if frmt.lower() == video_format.lower():
|
||||
matches.add('format')
|
||||
break
|
||||
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')
|
||||
|
|
Loading…
Reference in a new issue