diff options
author | morpheus65535 <[email protected]> | 2022-06-22 15:24:55 -0400 |
---|---|---|
committer | morpheus65535 <[email protected]> | 2022-06-22 15:24:55 -0400 |
commit | afc7fd2e5b39a9e116f489c7209219f2ae97dd7d (patch) | |
tree | 4958446b5759cd75e2ad3020d7bcaaf24024c678 | |
parent | e1bd02396ff4ddde8eb96a91dafc91ad81d15130 (diff) | |
parent | bd8f4027dd3225206e2a4600701878284ea632c0 (diff) | |
download | bazarr-1.0.5-beta.32.tar.gz bazarr-1.0.5-beta.32.zip |
Merge remote-tracking branch 'origin/development' into developmentv1.0.5-beta.32
-rw-r--r-- | libs/subliminal_patch/core.py | 4 | ||||
-rw-r--r-- | libs/subliminal_patch/providers/subdivx.py | 12 | ||||
-rw-r--r-- | tests/bazarr/app/test_get_providers.py | 26 | ||||
-rw-r--r-- | tests/bazarr/conftest.py | 7 | ||||
-rw-r--r-- | tests/conftest.py | 1 | ||||
-rw-r--r-- | tests/subliminal_patch/test_subdivx.py | 10 |
6 files changed, 53 insertions, 7 deletions
diff --git a/libs/subliminal_patch/core.py b/libs/subliminal_patch/core.py index 065e86134..806ec0bba 100644 --- a/libs/subliminal_patch/core.py +++ b/libs/subliminal_patch/core.py @@ -759,8 +759,8 @@ def scan_video(path, dont_use_actual_file=False, hints=None, providers=None, ski # guess hints["single_value"] = True - if "title" in hints: - hints["expected_title"] = [hints["title"]] + # if "title" in hints: + # hints["expected_title"] = [hints["title"]] guessed_result = guessit(guess_from, options=hints) diff --git a/libs/subliminal_patch/providers/subdivx.py b/libs/subliminal_patch/providers/subdivx.py index 11beeb722..be72ff052 100644 --- a/libs/subliminal_patch/providers/subdivx.py +++ b/libs/subliminal_patch/providers/subdivx.py @@ -42,12 +42,14 @@ class SubdivxSubtitle(Subtitle): language, hearing_impaired=False, page_link=page_link ) self.video = video - self.title = title + self.download_url = download_url - self.description = description self.uploader = uploader - self.release_info = self.title - if self.description and self.description.strip(): + + self.release_info = str(title) + self.description = str(description).strip() + + if self.description: self.release_info += " | " + self.description @property @@ -124,7 +126,7 @@ class SubdivxSubtitlesProvider(Provider): "masdesc": "", "subtitulos": "1", "realiza_b": "1", - "pg": "1", + "pg": 1, } logger.debug("Query: %s", query) diff --git a/tests/bazarr/app/test_get_providers.py b/tests/bazarr/app/test_get_providers.py new file mode 100644 index 000000000..d4db1c942 --- /dev/null +++ b/tests/bazarr/app/test_get_providers.py @@ -0,0 +1,26 @@ +import pytest + +import inspect + +from bazarr.app import get_providers + + +def test_get_providers_auth(): + for val in get_providers.get_providers_auth().values(): + assert isinstance(val, dict) + + +def test_get_providers_auth_with_provider_registry(): + """Make sure all providers will be properly initialized with bazarr + configs""" + from subliminal_patch.extensions import provider_registry + + auths = get_providers.get_providers_auth() + for key, val in auths.items(): + provider = provider_registry[key] + sign = inspect.signature(provider.__init__) + for sub_key in val.keys(): + if sub_key not in sign.parameters: + raise ValueError(f"'{sub_key}' parameter not present in {provider}") + + assert sign.parameters[sub_key] is not None diff --git a/tests/bazarr/conftest.py b/tests/bazarr/conftest.py new file mode 100644 index 000000000..865b92767 --- /dev/null +++ b/tests/bazarr/conftest.py @@ -0,0 +1,7 @@ +import os +import logging + +os.environ["NO_CLI"] = "true" +os.environ["SZ_USER_AGENT"] = "test" + +logging.getLogger("rebulk").setLevel(logging.WARNING) diff --git a/tests/conftest.py b/tests/conftest.py index 72f228e89..311264122 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -3,3 +3,4 @@ import os import sys sys.path.insert(0, os.path.join(os.path.dirname(__file__), "../libs/")) +sys.path.insert(0, os.path.join(os.path.dirname(__file__), "../bazarr/")) diff --git a/tests/subliminal_patch/test_subdivx.py b/tests/subliminal_patch/test_subdivx.py index 7dc77941f..ae9676aee 100644 --- a/tests/subliminal_patch/test_subdivx.py +++ b/tests/subliminal_patch/test_subdivx.py @@ -26,6 +26,16 @@ def test_list_subtitles_movie_with_year_fallback(movies): assert provider.list_subtitles(item, {Language("spa", "MX")}) +def test_handle_multi_page_search(episodes): + with SubdivxSubtitlesProvider() as provider: + subs = list( + provider._handle_multi_page_search( + "Game Of Thrones", episodes["got_s03e10"] + ) + ) + assert len(subs) > 100 + + @pytest.mark.parametrize( "episode_key,expected", [("breaking_bad_s01e01", 15), ("inexistent", 0)] ) |