mirror of
https://github.com/morpheus65535/bazarr.git
synced 2025-03-06 11:49:29 +08:00
Improve episode detection from compressed series packs
This commit is contained in:
parent
31e4f835cf
commit
75f3ac9f6c
1 changed files with 16 additions and 2 deletions
|
@ -77,8 +77,11 @@ class ProviderSubtitleArchiveMixin(object):
|
||||||
if len(subs_in_archive) == 1:
|
if len(subs_in_archive) == 1:
|
||||||
matching_sub = subs_in_archive[0]
|
matching_sub = subs_in_archive[0]
|
||||||
else:
|
else:
|
||||||
|
logger.debug("Subtitles in archive: %s", subs_in_archive)
|
||||||
|
|
||||||
for sub_name in subs_in_archive:
|
for sub_name in subs_in_archive:
|
||||||
guess = guessit(sub_name)
|
guess = guessit(sub_name)
|
||||||
|
|
||||||
sub_name_lower = sub_name.lower()
|
sub_name_lower = sub_name.lower()
|
||||||
|
|
||||||
# consider subtitle valid if:
|
# consider subtitle valid if:
|
||||||
|
@ -94,9 +97,12 @@ class ProviderSubtitleArchiveMixin(object):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
episodes = guess.get("episode")
|
episodes = guess.get("episode")
|
||||||
if is_episode and episodes and not isinstance(episodes, list):
|
|
||||||
|
if not isinstance(episodes, list):
|
||||||
episodes = [episodes]
|
episodes = [episodes]
|
||||||
|
|
||||||
|
episode_matches = episodes is not None and any(subtitle.episode == epi for epi in episodes)
|
||||||
|
|
||||||
if not is_episode or (
|
if not is_episode or (
|
||||||
(
|
(
|
||||||
subtitle.episode in episodes
|
subtitle.episode in episodes
|
||||||
|
@ -139,7 +145,11 @@ class ProviderSubtitleArchiveMixin(object):
|
||||||
if asked_for_rlsgrp in sub_name_lower:
|
if asked_for_rlsgrp in sub_name_lower:
|
||||||
release_group_matches = True
|
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
|
matching_sub = sub_name
|
||||||
break
|
break
|
||||||
|
|
||||||
|
@ -148,10 +158,14 @@ class ProviderSubtitleArchiveMixin(object):
|
||||||
else:
|
else:
|
||||||
subs_fallback.append(sub_name)
|
subs_fallback.append(sub_name)
|
||||||
|
|
||||||
|
|
||||||
if not matching_sub and not subs_unsure and not subs_fallback:
|
if not matching_sub and not subs_unsure and not subs_fallback:
|
||||||
logger.error("None of expected subtitle found in archive")
|
logger.error("None of expected subtitle found in archive")
|
||||||
return
|
return
|
||||||
|
|
||||||
|
elif matching_sub:
|
||||||
|
logger.debug("Matched subtitle found: %s", matching_sub)
|
||||||
|
|
||||||
elif subs_unsure:
|
elif subs_unsure:
|
||||||
matching_sub = subs_unsure[0]
|
matching_sub = subs_unsure[0]
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue