diff options
author | Vitiko <[email protected]> | 2022-05-20 15:03:03 -0400 |
---|---|---|
committer | Vitiko <[email protected]> | 2022-05-20 15:03:03 -0400 |
commit | 0e1120e037febedacb7a051871e9bd4660a8a0c8 (patch) | |
tree | adce836c5a82eeaf4c2367fc915099b5f4d32673 | |
parent | 0ec9cded647d4401250c34475d3981e24aa17e9b (diff) | |
download | bazarr-0e1120e037febedacb7a051871e9bd4660a8a0c8.tar.gz bazarr-0e1120e037febedacb7a051871e9bd4660a8a0c8.zip |
Subdivx provider: improve movie searches
-rw-r--r-- | libs/subliminal_patch/providers/subdivx.py | 9 | ||||
-rw-r--r-- | tests/subliminal_patch/test_subdivx.py | 9 |
2 files changed, 14 insertions, 4 deletions
diff --git a/libs/subliminal_patch/providers/subdivx.py b/libs/subliminal_patch/providers/subdivx.py index bc902363e..11beeb722 100644 --- a/libs/subliminal_patch/providers/subdivx.py +++ b/libs/subliminal_patch/providers/subdivx.py @@ -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 diff --git a/tests/subliminal_patch/test_subdivx.py b/tests/subliminal_patch/test_subdivx.py index 7ce4980ce..7dc77941f 100644 --- a/tests/subliminal_patch/test_subdivx.py +++ b/tests/subliminal_patch/test_subdivx.py @@ -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)] ) |