summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authormorpheus65535 <[email protected]>2023-05-09 21:26:09 -0400
committermorpheus65535 <[email protected]>2023-05-09 21:26:09 -0400
commit58868cff170be5dd8c19530bb5ca63415d857c9a (patch)
tree509159ec0ca46f4380c109791afe303bc8af40e8
parent2b5cd2b72e19469b545e4d35e2564d5219a36e7c (diff)
parent5f9418b1f3eae5b1acb5f8c4ecbd835726c6f63f (diff)
downloadbazarr-1.2.2-beta.3.tar.gz
bazarr-1.2.2-beta.3.zip
Merge remote-tracking branch 'origin/development' into developmentv1.2.2-beta.3
-rw-r--r--libs/subliminal_patch/providers/subdivx.py11
-rw-r--r--tests/subliminal_patch/test_subdivx.py13
2 files changed, 24 insertions, 0 deletions
diff --git a/libs/subliminal_patch/providers/subdivx.py b/libs/subliminal_patch/providers/subdivx.py
index b20523cbf..6bdc58eb0 100644
--- a/libs/subliminal_patch/providers/subdivx.py
+++ b/libs/subliminal_patch/providers/subdivx.py
@@ -136,6 +136,9 @@ class SubdivxSubtitlesProvider(Provider):
if len(subtitles) <= 5:
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:
for query in (video.title, f"{video.title} ({video.year})"):
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)
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:
logger.debug("Not a season/episode: %s", title)
return False
diff --git a/tests/subliminal_patch/test_subdivx.py b/tests/subliminal_patch/test_subdivx.py
index 96342075c..33f938766 100644
--- a/tests/subliminal_patch/test_subdivx.py
+++ b/tests/subliminal_patch/test_subdivx.py
@@ -74,6 +74,19 @@ def test_list_subtitles_episode_with_title_only_fallback(episodes):
subtitles = provider.list_subtitles(item, {Language("spa", "MX")})
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):
subtitle = SubdivxSubtitle(