fix(providers): accept an IMDb or AniList match on any title the ranker used

This commit is contained in:
imSp4rky
2026-11-28 17:42:44 -07:00
parent ed743a81b9
commit 94d0b67d20
8 changed files with 132 additions and 46 deletions
+10 -3
View File
@@ -128,7 +128,7 @@ def test_the_tvdb_order_resolves_a_tvdb_id_and_keeps_it_for_the_tags(monkeypatch
def test_a_series_is_searched_once_and_each_title_fetches_its_external_ids(monkeypatch: pytest.MonkeyPatch) -> None:
calls = Providers(monkeypatch, found(title="The Show"))
monkeypatch.setattr(providers, "fuzzy_match", lambda a, b: a == b)
monkeypatch.setattr(providers, "result_matches", lambda result, title: result.title == title)
metadata = TitleMetadata(cache=CACHE)
metadata.search(episode(1, 1))
metadata.search(episode(1, 2))
@@ -141,12 +141,19 @@ def test_a_series_is_searched_once_and_each_title_fetches_its_external_ids(monke
def test_a_search_that_matches_another_show_sets_no_id(monkeypatch: pytest.MonkeyPatch) -> None:
calls = Providers(monkeypatch, found(title="Another Show"))
monkeypatch.setattr(providers, "fuzzy_match", lambda a, b: a == b)
monkeypatch.setattr(providers, "result_matches", lambda result, title: result.title == title)
metadata = TitleMetadata()
metadata.search(episode(1, 1))
assert (metadata.tmdb_id, metadata.searched, calls.fetched) == (None, True, [])
def test_a_search_matches_on_another_name_of_the_result(monkeypatch: pytest.MonkeyPatch) -> None:
Providers(monkeypatch, found(title="Another Show", names=("Another Show", "The Show")))
metadata = TitleMetadata()
metadata.search(episode(1, 1))
assert metadata.tmdb_id == 1396
def test_a_given_tmdb_id_is_kept(monkeypatch: pytest.MonkeyPatch) -> None:
Providers(monkeypatch, found(tmdb_id=1, title="Other"))
metadata = TitleMetadata(tmdb_id=5)
@@ -224,7 +231,7 @@ def test_enrich_fills_the_air_dates_of_a_daily_series(monkeypatch: pytest.Monkey
def test_a_listing_prints_the_search_match(monkeypatch: pytest.MonkeyPatch) -> None:
Providers(monkeypatch, found(title="The Show"))
monkeypatch.setattr(providers, "fuzzy_match", lambda a, b: a == b)
monkeypatch.setattr(providers, "result_matches", lambda result, title: result.title == title)
with console.capture() as captured:
TitleMetadata().search(episode(1, 1), listing=True)
assert "Search -> The Show (ID 1396)" in captured.get()