mirror of
https://github.com/morpheus65535/bazarr.git
synced 2024-11-10 09:02:44 +08:00
Subdivx Provider: improve series matching
This commit is contained in:
parent
98c7364ce0
commit
5f9418b1f3
2 changed files with 24 additions and 0 deletions
|
@ -136,6 +136,9 @@ class SubdivxSubtitlesProvider(Provider):
|
||||||
if len(subtitles) <= 5:
|
if len(subtitles) <= 5:
|
||||||
subtitles += self._handle_multi_page_search(video.series, video, 1)
|
subtitles += self._handle_multi_page_search(video.series, video, 1)
|
||||||
|
|
||||||
|
# Try with episode title as last resort
|
||||||
|
if not subtitles and video.title != video.series:
|
||||||
|
subtitles += self._handle_multi_page_search(video.title, video, 1)
|
||||||
else:
|
else:
|
||||||
for query in (video.title, f"{video.title} ({video.year})"):
|
for query in (video.title, f"{video.title} ({video.year})"):
|
||||||
subtitles += self._handle_multi_page_search(query, video)
|
subtitles += self._handle_multi_page_search(query, video)
|
||||||
|
@ -309,6 +312,14 @@ def _check_episode(video, title):
|
||||||
logger.debug("Series year doesn't match: %s", title)
|
logger.debug("Series year doesn't match: %s", title)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
# Include matches where the episode title is present
|
||||||
|
if (
|
||||||
|
video.series.lower() in title.lower()
|
||||||
|
and (video.title or "").lower() in title.lower()
|
||||||
|
):
|
||||||
|
logger.debug("Episode title found in title: %s ~ %s", video.title, title)
|
||||||
|
return True
|
||||||
|
|
||||||
if season_num is None:
|
if season_num is None:
|
||||||
logger.debug("Not a season/episode: %s", title)
|
logger.debug("Not a season/episode: %s", title)
|
||||||
return False
|
return False
|
||||||
|
|
|
@ -74,6 +74,19 @@ def test_list_subtitles_episode_with_title_only_fallback(episodes):
|
||||||
subtitles = provider.list_subtitles(item, {Language("spa", "MX")})
|
subtitles = provider.list_subtitles(item, {Language("spa", "MX")})
|
||||||
assert len(subtitles) > 2
|
assert len(subtitles) > 2
|
||||||
|
|
||||||
|
def test_list_subtitles_episode_with_episode_title_fallback(episodes):
|
||||||
|
item = list(episodes.values())[0]
|
||||||
|
item.series = "30 for 30"
|
||||||
|
item.title = "The Two Escobars"
|
||||||
|
item.season = 1
|
||||||
|
item.episode = 16
|
||||||
|
|
||||||
|
with SubdivxSubtitlesProvider() as provider:
|
||||||
|
sub = provider.list_subtitles(item, {Language("spa", "MX")})[0]
|
||||||
|
assert sub.get_matches(item)
|
||||||
|
provider.download_subtitle(sub)
|
||||||
|
assert sub.is_valid()
|
||||||
|
|
||||||
|
|
||||||
def test_download_subtitle(movies):
|
def test_download_subtitle(movies):
|
||||||
subtitle = SubdivxSubtitle(
|
subtitle = SubdivxSubtitle(
|
||||||
|
|
Loading…
Reference in a new issue