summaryrefslogtreecommitdiffhomepage
path: root/tests/subliminal_patch
diff options
context:
space:
mode:
authorVitiko <[email protected]>2022-10-26 20:27:49 -0400
committerVitiko <[email protected]>2022-10-26 20:27:49 -0400
commitfe8101dceec2f84eddd410c157bdc6ed59403776 (patch)
tree13c5504be43d067ee0c21561bb94dda42b77d257 /tests/subliminal_patch
parent254df4446f5f26df4bcffa49821db19fd8be1204 (diff)
downloadbazarr-fe8101dceec2f84eddd410c157bdc6ed59403776.tar.gz
bazarr-fe8101dceec2f84eddd410c157bdc6ed59403776.zip
Subf2m Provider: add more improvements
* Retry queries when subf2m server returns 503 * Add support for episode titles in season packs * Add support for season packs with "Complete Series" titles
Diffstat (limited to 'tests/subliminal_patch')
-rw-r--r--tests/subliminal_patch/test_subf2m.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/subliminal_patch/test_subf2m.py b/tests/subliminal_patch/test_subf2m.py
index 0e1b70121..5db7d290e 100644
--- a/tests/subliminal_patch/test_subf2m.py
+++ b/tests/subliminal_patch/test_subf2m.py
@@ -33,6 +33,7 @@ def test_search_movie(movies, title, year, expected_url):
("Breaking Bad", 1, "/subtitles/breaking-bad-first-season"),
("House Of The Dragon", 1, "/subtitles/house-of-the-dragon-first-season"),
("The Bear", 1, "/subtitles/the-bear-first-season"),
+ ("Courage the Cowardly Dog", 1, "/subtitles/courage-the-cowardly-dog"),
],
)
def test_search_tv_show_season(episodes, title, season, expected_url):
@@ -62,6 +63,16 @@ def test_find_episode_subtitles(language):
assert sub.language == language
+def test_fint_episode_subtitles_from_complete_series_path(episodes):
+ path = "/subtitles/courage-the-cowardly-dog"
+
+ with Subf2mProvider() as provider:
+ for sub in provider._find_episode_subtitles(
+ path, 1, 1, Language.fromalpha2("en")
+ ):
+ assert sub.language == Language.fromalpha2("en")
+
+
@pytest.fixture
def subtitle():
release_info = """Dune-2021.All.WEBDLL
@@ -143,3 +154,17 @@ def test_download_subtitle_episode(subtitle_episode):
with Subf2mProvider() as provider:
provider.download_subtitle(subtitle_episode)
assert subtitle_episode.is_valid()
+
+
+def test_download_subtitle_episode_with_title():
+ sub = Subf2mSubtitle(
+ Language.fromalpha2("en"),
+ "https://subf2m.co/subtitles/courage-the-cowardly-dog/english/2232402",
+ "Season 3 complete.",
+ 13,
+ )
+
+ sub.episode_title = "Feast of the Bullfrogs"
+ with Subf2mProvider() as provider:
+ provider.download_subtitle(sub)
+ assert sub.is_valid()