fix(tmdb): reject zero-confidence auto-match candidates#1379
Merged
revam merged 1 commit intoJul 6, 2026
Conversation
… and manual search `AutoSearchForShowUsingTitle`/`AutoSearchMovieUsingTitle` always auto-linked the top-scored candidate even when it had no title or date correlation to the AniDB entry at all (`MatchRating.FirstAvailable`) — it only reached scoring because TMDB's search returned it and it happened to carry the `animation` genre tag. This let unrelated content (e.g. adult titles genre-tagged as animation on TMDB) get auto-linked to legitimate anime like "One Piece" purely by coincidence. - Added `IsAcceptableAutoMatch` to reject `FirstAvailable` before linking in both the show and movie auto-match paths, and applied the same floor to the transient-outage fallback (which previously guessed blindly when `GetTvShowAsync`/`GetMovieAsync` failed for every candidate). This mirrors the existing convention in `TmdbLinkingService`'s episode-level matching, which already treats `FirstAvailable` as "no match." - Manual TMDB search (used by the WebUI's link-selection panel) returned TMDB's raw search order, which ranks purely on title-text relevance with no genre awareness. Added a stable sort (by `animation` genre membership) to the paged results in `SearchMoviesRaw`/`SearchShowsRaw` — nothing is filtered out, a human still picks the result, this only reorders the page so genuine anime surfaces first. - Extracted the repeated `"animation"` literal into an `AnimationGenre` constant. This does not affect adult-content handling — `include_adult` is still driven entirely by `anime.IsRestricted` from AniDB, so correctly-matched restricted anime are unaffected in both paths. The fix only requires that AniDB's own title or air-date data actually corroborate the TMDB candidate before auto-linking, and reorders (without hiding) manual search results by genre.
Foowy
force-pushed
the
fix/tmdb-auto-match-confidence-floor
branch
from
July 6, 2026 15:47
e021114 to
e307506
Compare
|
revam
approved these changes
Jul 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
AutoSearchForShowUsingTitle/AutoSearchMovieUsingTitlepreviously auto-linked the top-scored TMDB candidate even when it had zero title or date correlation to the AniDB entry (MatchRating.FirstAvailable) — it only reached scoring because TMDB's search returned it and it happened to carry theanimationgenre tag. This let unrelated content (e.g. adult titles genre-tagged as animation on TMDB) get auto-linked to legitimate anime (reported: "One Piece" matching unrelated adult content).IsAcceptableAutoMatchto rejectFirstAvailablebefore linking in both the show and movie auto-match paths, and applied the same floor to the transient-outage fallback (which previously guessed blindly whenGetTvShowAsync/GetMovieAsyncfailed for every candidate).TmdbLinkingService's episode-level matching, which already treatsFirstAvailableas "no match."include_adultis still driven entirely byanime.IsRestrictedfrom AniDB, so correctly-matched restricted anime are unaffected. The fix only requires that AniDB's own title or air-date data actually corroborate the TMDB candidate before auto-linking.Test plan
IsAcceptableAutoMatch_RejectsOnlyFirstAvailabletheory covering allMatchRatingvaluesdotnet build Shoko.Server.sln— 0 errorsdotnet test Shoko.Tests/Shoko.Tests.csproj— full suite passes