Subdivx provider: improve movie searches

pull/1849/head
Vitiko 3 years ago
parent 0ec9cded64
commit 0e1120e037

@ -109,10 +109,11 @@ class SubdivxSubtitlesProvider(Provider):
):
subtitles += self._handle_multi_page_search(query, video)
else:
# Subdvix has problems searching foreign movies if the year is
# appended. A proper solution would be filtering results with the
# year in self._parse_subtitles_page.
subtitles += self._handle_multi_page_search(video.title, video)
for query in (video.title, f"{video.title} ({video.year})"):
subtitles += self._handle_multi_page_search(query, video)
# Second query is a fallback
if subtitles:
break
return subtitles

@ -17,6 +17,15 @@ def test_list_subtitles_movie(movies):
assert len(subtitles) >= 9
def test_list_subtitles_movie_with_year_fallback(movies):
item = list(movies.values())[0]
item.title = "Everything Everywhere All at Once"
item.year = 2022
with SubdivxSubtitlesProvider() as provider:
assert provider.list_subtitles(item, {Language("spa", "MX")})
@pytest.mark.parametrize(
"episode_key,expected", [("breaking_bad_s01e01", 15), ("inexistent", 0)]
)

Loading…
Cancel
Save