Hold back Jellyfin favorites for the playing track until it stops #3

Merged
james merged 1 commit from jellyfin-favorite-during-playback into main 2026-11-01 11:41:25 +00:00
Owner

Likes made in Music Assistant while the track is playing never stuck in Jellyfin.

Cause (Jellyfin 12.4, also on master): SessionManager.OnPlaybackProgress and OnPlaybackStopped read the user data from the session's cached FullNowPlayingItem, a snapshot from when playback started, and save the whole row back. A favorite set mid-track is overwritten by the next progress report. Seen live: Perfectly Chilled was liked at 11:22:38 and reverted by MA's progress report at 11:22:44. Why Hide and the six tracks fixed by hand earlier were all lost the same way.

Fix: set_favorite now holds back the change while the track has an open playback session, and sends the latest change right after that session's stopped report (or the marked-unplayed call). Likes for tracks that aren't playing are still sent straight away.

Tests: both tests pass in the live MA image with the patched provider. New cases: liked while playing (sent after the stop), liked then unliked (only the unlike is sent), another track playing (not held back), marked unplayed.

Limits:

  • A like made during playback shows in Jellyfin when the track ends, not straight away.
  • If MA restarts mid-track, the held change is lost.
  • Repeat-one can still revert the like, because Jellyfin keeps the same stale item for the repeated track.

Upstream: this is Jellyfin bug jellyfin#14981. The server-side fix, jellyfin#18366 (reload user data before each playback save), is open and not yet merged. Once a Jellyfin release includes it, the hold-back here can be removed and favorites can be sent straight away again.

🤖 Generated with Claude Code

https://claude.ai/code/session_01CbPPc19ztjvWzSc5JPMH2B

Likes made in Music Assistant while the track is playing never stuck in Jellyfin. **Cause (Jellyfin 12.4, also on master):** `SessionManager.OnPlaybackProgress` and `OnPlaybackStopped` read the user data from the session's cached `FullNowPlayingItem`, a snapshot from when playback started, and save the whole row back. A favorite set mid-track is overwritten by the next progress report. Seen live: *Perfectly Chilled* was liked at 11:22:38 and reverted by MA's progress report at 11:22:44. *Why Hide* and the six tracks fixed by hand earlier were all lost the same way. **Fix:** `set_favorite` now holds back the change while the track has an open playback session, and sends the latest change right after that session's stopped report (or the marked-unplayed call). Likes for tracks that aren't playing are still sent straight away. **Tests:** both tests pass in the live MA image with the patched provider. New cases: liked while playing (sent after the stop), liked then unliked (only the unlike is sent), another track playing (not held back), marked unplayed. **Limits:** - A like made during playback shows in Jellyfin when the track ends, not straight away. - If MA restarts mid-track, the held change is lost. - Repeat-one can still revert the like, because Jellyfin keeps the same stale item for the repeated track. **Upstream:** this is Jellyfin bug [jellyfin#14981](https://github.com/jellyfin/jellyfin/issues/14981). The server-side fix, [jellyfin#18366](https://github.com/jellyfin/jellyfin/pull/18366) (reload user data before each playback save), is open and not yet merged. Once a Jellyfin release includes it, the hold-back here can be removed and favorites can be sent straight away again. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01CbPPc19ztjvWzSc5JPMH2B
Jellyfin saves every progress and stopped report with the user data copy it
took when playback started, so a favorite sent mid-track was reverted at the
next progress report (seen live: liked 11:22:38, reverted by the 11:22:44
progress report). set_favorite now holds the change while the track has an
open playback session and sends the latest one right after the stopped (or
marked-unplayed) report.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CbPPc19ztjvWzSc5JPMH2B
james merged commit d952a1d541 into main 2026-11-01 11:41:25 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
music-assistant/docker-music-assistant!3
No description provided.