Skip to content

fix(AniList): library parsing and list updates - #3300

Open
liubquanti wants to merge 1 commit into
recloudstream:masterfrom
liubquanti-frk:fix/anilist-parsing
Open

liubquanti wants to merge 1 commit into
recloudstream:masterfrom
liubquanti-frk:fix/anilist-parsing

Conversation

@liubquanti

Copy link
Copy Markdown

Fix AniList library parsing and list updates

Since #2952 (migration to kotlinx serialization) AniList sync is broken in two ways.

1. Library list fails to load

Jackson used to coerce null into 0 for non-nullable Int fields, kotlinx does not.
AniList returns null for completedAt / startedAt dates of any entry that isn't
completed, as well as episodes (airing shows) and seasonYear (unannounced shows), so
getFullAniListList fails on practically every account:

Unexpected JSON token at offset 116: Unexpected symbol 'n' in numeric literal at path:
$.data.MediaListCollection.lists[0].entries[0].completedAt.year

These fields are now nullable. StartedAt fields are Int? to match AniList's
FuzzyDate type (they were String?, but AniList sends numbers).

2. Adding / updating titles silently fails

SaveMediaListEntry always passes scoreRaw: $scoreRaw, progress: $progress, but only
declares those variables when they are non-null. When no score is set AniList rejects the
whole mutation:

Variable "$scoreRaw" is not defined.
Variable "$progress" is not defined.

postDataAboutId only checked data != "", so the failure was reported as success.
Now only the variables that have a value are declared and passed, and a response
containing GraphQL errors is logged and returns false.

Testing

  • Added AniListParsingTest covering a list response with null dates/episodes and
    GraphQL error detection.
  • Verified the broken mutation against the live AniList API.
  • Tested on a Chromecast with Google TV (Android 14): the AniList library tab loads
    again, and status updates without a score now reach AniList.

- Make nullable the AniList fields that can be null (dates, episodes,
  seasonYear, updatedAt). Since the move to kotlinx serialization these
  are no longer coerced to 0, which made the library list fail to parse
  for practically every account.
- SaveMediaListEntry: only declare and pass scoreRaw / progress when they
  have a value. AniList rejected the whole mutation otherwise
  ("Variable $scoreRaw is not defined"), while it was reported as success.
- Treat GraphQL errors in the mutation response as a failure.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@fire-light42 fire-light42 added Review needed The pull request contains no obvious blockers. It just needs a review before merging. AI Assisted This pull request was AI assisted (or generated). labels Nov 1, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI Assisted This pull request was AI assisted (or generated). Review needed The pull request contains no obvious blockers. It just needs a review before merging.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants