Currently only configurable via manual `data/config/config.ini` text edition. New configurable values are `series_scores` and `movie_scores`. For each config section, the sum of the config values (except hash) must be equal to the hash value plus one (1), otherwise default values will be used (notified via debug log). Hash values are not meant to be modified; the value is shown in `config.ini` for reference. Modifying hash values would imply breaking Bazarr's score logic.pull/1991/head v1.1.3-beta.12
parent
0b8274ec3e
commit
708fbfcd8e
@ -0,0 +1,10 @@
|
||||
from bazarr.app import config
|
||||
|
||||
|
||||
def test_get_settings():
|
||||
assert isinstance(config.get_settings(), dict)
|
||||
|
||||
|
||||
def test_get_scores():
|
||||
assert isinstance(config.get_scores()["movie"], dict)
|
||||
assert isinstance(config.get_scores()["episode"], dict)
|
@ -0,0 +1,36 @@
|
||||
from subliminal_patch import score
|
||||
from subliminal_patch.providers.karagarga import KaragargaSubtitle
|
||||
|
||||
|
||||
# def __call__(self, matches, subtitle, video, hearing_impaired=None):
|
||||
|
||||
|
||||
def test_compute_score_set_var(movies, languages):
|
||||
subtitle = KaragargaSubtitle(languages["en"], "", "", "")
|
||||
score.compute_score({"hash"}, subtitle, movies["dune"])
|
||||
|
||||
|
||||
def test_compute_score_set_var_w_episode(episodes, languages):
|
||||
subtitle = KaragargaSubtitle(languages["en"], "", "", "")
|
||||
score.compute_score({"hash"}, subtitle, episodes["breaking_bad_s01e01"])
|
||||
|
||||
|
||||
def test_compute_score_defaults():
|
||||
assert score.ComputeScore()._scores == score.DEFAULT_SCORES
|
||||
|
||||
|
||||
def test_compute_score_custom_invalid():
|
||||
assert (
|
||||
score.ComputeScore({"movie": {"hash": 120}, "episode": {"hash": 321}})._scores
|
||||
== score.DEFAULT_SCORES
|
||||
)
|
||||
|
||||
|
||||
def test_compute_score_custom_valid():
|
||||
scores_copy = score.DEFAULT_SCORES.copy()
|
||||
scores_copy["movie"]["release_group"] = 12
|
||||
scores_copy["movie"]["source"] = 8
|
||||
|
||||
scores_ = score.ComputeScore(scores_copy)
|
||||
assert scores_._scores["movie"]["release_group"] == 12
|
||||
assert scores_._scores["movie"]["source"] == 8
|
@ -0,0 +1,29 @@
|
||||
from subliminal_patch import subtitle
|
||||
|
||||
|
||||
def test_guess_matches_w_edition_only_video(movies):
|
||||
movie = movies["dune"]
|
||||
movie.edition = "Director's Cut"
|
||||
matches = subtitle.guess_matches(movie, {})
|
||||
assert "edition" not in matches
|
||||
|
||||
|
||||
def test_guess_matches_w_edition_only_guess(movies):
|
||||
movie = movies["dune"]
|
||||
movie.edition = None
|
||||
matches = subtitle.guess_matches(movie, {"edition": "Director's Cut"})
|
||||
assert "edition" not in matches
|
||||
|
||||
|
||||
def test_guess_matches_w_edition_both(movies):
|
||||
movie = movies["dune"]
|
||||
movie.edition = "Director's Cut"
|
||||
matches = subtitle.guess_matches(movie, {"edition": "Director's Cut"})
|
||||
assert "edition" in matches
|
||||
|
||||
|
||||
def test_guess_matches_w_edition_both_empty(movies):
|
||||
movie = movies["dune"]
|
||||
movie.edition = None
|
||||
matches = subtitle.guess_matches(movie, {})
|
||||
assert "edition" in matches
|
Loading…
Reference in new issue