fix(server): improve Jellyfin watch data aggregation#2488
Merged
Conversation
enoch85
added a commit
that referenced
this pull request
Mar 13, 2026
PR #2488 - fix(server): improve Jellyfin watch data aggregation - Improve watch history aggregation with per-user UserData lookups - Honor Jellyfin played threshold (MaxResumePct) for watch status - Add getItemFavoritedBy and getTotalPlayCount methods - Address review feedback with debug logging and fallback handling
Collaborator
Author
|
Tested and works! Manual validation against Jellyfin looks good:
Cache The Jellyfin watch-data fix appears to work, and the second evaluation produced no repeated Jellyfin user-data activity within the cache TTL. |
The dedicated /UserItems/{itemId}/UserData endpoint does not reliably
return per-user data when authenticating with an API key on all Jellyfin
versions, causing viewCount=0 and lastViewedAt=null for watched items.
Revert to the proven getItems query with enableUserData=true while
keeping all other PR #2488 improvements (centralized batching, caching).
Fixes #2509
050c19e to
1ea1622
Compare
enoch85
added a commit
that referenced
this pull request
Mar 21, 2026
PR #2488 - fix(server): revert Jellyfin getItemUserData to use getItems endpoint - Revert per-user data fetching from dedicated /UserItems/{itemId}/UserData endpoint back to getItems with enableUserData=true - The dedicated endpoint does not reliably return per-user data with API key auth on all Jellyfin versions - Fixes viewCount=0 and lastViewedAt=null regression reported in #2509 - Update test mocks to match reverted getItems call signature
Contributor
|
🎉 This PR is included in version 3.2.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
enoch85
added a commit
that referenced
this pull request
Apr 9, 2026
Extract mapUsersBatched as the single per-user fan-out primitive. getAllUserItemData (introduced in #2488 to centralise watch history / favorited-by / play-count aggregation) and the new getDescendantEpisodeWatchers now both route through it, removing the duplicated batching loop from the previous commit.
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.
Description & Design
This switches Jellyfin per-user item lookups to the dedicated user-data endpoint, centralizes the shared batching logic, and adds caching for favorites and total play count.
This fixes incorrect show
lastViewedAtaggregation in Jellyfin and reduces repeated per-user API work in the same adapter path.Related issue
Fixes #2486
Fixes #2427
Checklist
How to test
yarn format.yarn test.lastViewedAtpicks up the latest watched episode date.