Merge remote-tracking branch 'origin/development' into development

This commit is contained in:
morpheus65535 2022-06-22 15:24:55 -04:00
commit afc7fd2e5b
6 changed files with 53 additions and 7 deletions

View File

@ -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)

View File

@ -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)

View File

@ -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

7
tests/bazarr/conftest.py Normal file
View File

@ -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)

View File

@ -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/"))

View File

@ -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)]
)