feat(track): add manga relations & recommendations query (AniList, MyAnimeList) - #2132
Open
VictorVow wants to merge 3 commits into
Open
feat(track): add manga relations & recommendations query (AniList, MyAnimeList)#2132VictorVow wants to merge 3 commits into
VictorVow wants to merge 3 commits into
Conversation
Add a mangaRelated GraphQL query that returns relations and recommendations for a manga from AniList and MyAnimeList. The remote media id is resolved from an existing track record, falling back to a title search on the logged-in tracker. AniList relations and recommendations are fetched via the public (unauthenticated) GraphQL endpoint and filtered to manga; MyAnimeList uses the related_manga and recommendations fields of the manga details endpoint. Per-tracker failures yield an empty list instead of failing the whole query.
When a manga has no tracker binding, the related/recommendation lookup falls back to searching the tracker by title. Previously it used the top search hit unconditionally, which could surface relations for an unrelated entry when no good match existed. Only use a search result whose title is a confident match for the manga title (normalized equality or Levenshtein similarity >= 0.9), otherwise return no results for that tracker.
Compare the manga title against each search result's alternative titles (AniList romaji/english/native + synonyms, MyAnimeList en/ja + synonyms) in addition to its primary title when resolving the related-search fallback. This lets a localized source title confidently match an entry whose primary title is in another language (e.g. an "Attack on Titan" source matching AniList/MAL's romaji "Shingeki no Kyojin"), which the previous single-title comparison rejected. The alternative titles are carried on the (non-persisted) TrackSearch model and populated by the AniList and MyAnimeList search calls.
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.
What this does
Adds a GraphQL
mangaRelatedquery that returns relations and recommendations for a manga from AniList and MyAnimeList, so clients can show a "Related" view per manga.How the remote media id is resolved
For each tracker, per manga:
A confident match is normalized equality, or Levenshtein similarity ≥ 0.9, compared against the candidate's primary and alternative titles (AniList
romaji/english/native+synonyms, MALen/ja+synonyms). This lets a localized source title match an entry whose primary title is in another language (e.g. an "Attack on Titan" source matching the romaji "Shingeki no Kyojin").Per-tracker failures (not logged in, no match, network error) yield an empty list for that tracker instead of failing the whole query.
Implementation notes
type: MANGA(drops anime adaptations).related_mangaandrecommendationsfields of the manga details endpoint.TrackSearchmodel only — not persisted to the DB and not exposed in the tracking GraphQL types.Testing
ktlintCheckclean.Companion PR
The WebUI side (the "Related" button + modal) is Suwayomi/Suwayomi-WebUI#1122 and depends on this query being available.