mirror of
https://github.com/morpheus65535/bazarr.git
synced 2025-01-31 02:57:50 +08:00
Subdivx provider: improve movie searches
This commit is contained in:
parent
0ec9cded64
commit
0e1120e037
2 changed files with 14 additions and 4 deletions
|
@ -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…
Reference in a new issue