diff options
author | Vitiko <[email protected]> | 2022-04-16 16:45:20 -0400 |
---|---|---|
committer | Vitiko <[email protected]> | 2022-04-16 16:45:20 -0400 |
commit | 75f3ac9f6cec587bc3b0bb3a41e9fd18d10cd02f (patch) | |
tree | 464ced993d502f8189ec62cd31bcf2d1fd0dc511 /libs | |
parent | 31e4f835cf28bd1f5c4840a958126fce046591ee (diff) | |
download | bazarr-75f3ac9f6cec587bc3b0bb3a41e9fd18d10cd02f.tar.gz bazarr-75f3ac9f6cec587bc3b0bb3a41e9fd18d10cd02f.zip |
Improve episode detection from compressed series packsv1.0.4-beta.23
Diffstat (limited to 'libs')
-rw-r--r-- | libs/subliminal_patch/providers/mixins.py | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/libs/subliminal_patch/providers/mixins.py b/libs/subliminal_patch/providers/mixins.py index 63549066e..5b9358a45 100644 --- a/libs/subliminal_patch/providers/mixins.py +++ b/libs/subliminal_patch/providers/mixins.py @@ -77,8 +77,11 @@ class ProviderSubtitleArchiveMixin(object): if len(subs_in_archive) == 1: matching_sub = subs_in_archive[0] else: + logger.debug("Subtitles in archive: %s", subs_in_archive) + for sub_name in subs_in_archive: guess = guessit(sub_name) + sub_name_lower = sub_name.lower() # consider subtitle valid if: @@ -94,9 +97,12 @@ class ProviderSubtitleArchiveMixin(object): continue episodes = guess.get("episode") - if is_episode and episodes and not isinstance(episodes, list): + + if not isinstance(episodes, list): episodes = [episodes] + episode_matches = episodes is not None and any(subtitle.episode == epi for epi in episodes) + if not is_episode or ( ( subtitle.episode in episodes @@ -139,7 +145,11 @@ class ProviderSubtitleArchiveMixin(object): if asked_for_rlsgrp in sub_name_lower: release_group_matches = True - if release_group_matches and source_matches: + if not is_episode and release_group_matches and source_matches: + matching_sub = sub_name + break + + if is_episode and episode_matches: matching_sub = sub_name break @@ -148,10 +158,14 @@ class ProviderSubtitleArchiveMixin(object): else: subs_fallback.append(sub_name) + if not matching_sub and not subs_unsure and not subs_fallback: logger.error("None of expected subtitle found in archive") return + elif matching_sub: + logger.debug("Matched subtitle found: %s", matching_sub) + elif subs_unsure: matching_sub = subs_unsure[0] |