mirror of
https://github.com/morpheus65535/bazarr.git
synced 2024-11-13 11:12:48 +08:00
708fbfcd8e
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.
36 lines
1.1 KiB
Python
36 lines
1.1 KiB
Python
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
|