quintodrome/server/subsonic/responses/.snapshots
Deluan Quintão 94eb6c522b
feat(subsonic): implement playbackReport OpenSubsonic extension (#5442)
* feat(req): add Float64Or helper for parsing float query params

* feat(scrobbler): extend NowPlayingInfo with state/position/rate fields

* feat(scrobbler): implement ReportPlayback with state machine and auto-scrobble

* feat(responses): add state/positionMs/playbackRate to NowPlayingEntry

* feat(subsonic): add reportPlayback endpoint handler

* feat(subsonic): include state/positionMs/playbackRate in getNowPlaying response

* feat(subsonic): register playbackReport OpenSubsonic extension

* test(e2e): add reportPlayback endpoint e2e tests

* refactor(scrobbler): simplify ReportPlayback — extract helpers, remove duplication

- Add state constants and exported ValidStates map
- Extract remainingTTL() helper (was duplicated 3x)
- Merge playing/paused switch cases into single branch
- Use Get instead of GetWithParticipants for non-stopped states
- Guard NowPlayingCount broadcast with count-change detection
- Use cache entry for NowPlaying dispatch instead of extra DB query
- Remove redundant Position field from NowPlayingInfo

* refactor(scrobbler): skip DB query in playing/paused when playMap has entry

* fix(play_tracker): handle errors when adding/updating NowPlayingInfo in cache

Signed-off-by: Deluan <deluan@navidrome.org>

* refactor(play_tracker): replace sort with slices.SortFunc for NowPlayingInfo

Signed-off-by: Deluan <deluan@navidrome.org>

* fix(play_tracker): check all ReportPlayback errors in tests

Replace _ = with explicit error assertions to avoid masking
failures in intermediate calls.

Signed-off-by: Deluan <deluan@navidrome.org>

* test(e2e): use real PlayTracker and assert getNowPlaying after reportPlayback

Replace noopPlayTracker with a real PlayTracker backed by the E2E
database. E2E tests now verify the full round-trip: reportPlayback
creates/updates/removes entries visible via getNowPlaying, including
state, positionMs, and playbackRate fields.

Export NewPlayTracker constructor for use outside the scrobbler package.

* fix(play_tracker): account for playback rate in TTL and detect track switches

The remainingTTL function now divides remaining time by the playback rate,
so cache entries expire correctly at non-1x speeds (e.g., 2x playback halves
the TTL). Zero/negative rates default to 1.0. The playing/paused case now
checks if the cached MediaFile ID matches the reported mediaId, falling back
to a DB fetch when the client switches tracks without sending stopped/starting.
Adds parameterized tests for remainingTTL covering rate variations and edge cases.

* fix(subsonic): validate positionMs and playbackRate in reportPlayback

Reject negative positionMs values and invalid playbackRate values (NaN,
Inf, zero, negative) at the API boundary before they reach TTL and
position estimation math. Returns clear error messages for each case.

* feat(play_tracker): add ClientId and ClientName to ReportPlayback parameters

Signed-off-by: Deluan <deluan@navidrome.org>

* refactor(play_tracker): replace NowPlaying method with ReportPlayback calls

Signed-off-by: Deluan <deluan@navidrome.org>

* refactor(play_tracker_test): remove redundant TTL behavior tests and clean up mockPluginLoader

Signed-off-by: Deluan <deluan@navidrome.org>

---------

Signed-off-by: Deluan <deluan@navidrome.org>
2026-04-30 23:04:05 -04:00
..
.gitattributes test: enable Subsonic response snapshot tests on Windows (#5427) 2026-04-27 20:19:28 -04:00
Responses AlbumInfo with data should match .JSON chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses AlbumInfo with data should match .XML chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses AlbumInfo without data should match .JSON chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses AlbumInfo without data should match .XML chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses AlbumList with data should match .JSON feat: new "Subsonic Minimal Clients" configuration option (#4850) 2026-01-16 05:55:21 -05:00
Responses AlbumList with data should match .XML feat: new "Subsonic Minimal Clients" configuration option (#4850) 2026-01-16 05:55:21 -05:00
Responses AlbumList with OS data should match .JSON fix(subsonic): always include mandatory title field in Child responses 2026-03-15 13:36:26 -04:00
Responses AlbumList with OS data should match .XML fix(subsonic): always include mandatory title field in Child responses 2026-03-15 13:36:26 -04:00
Responses AlbumList without data should match .JSON chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses AlbumList without data should match .XML chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses AlbumWithSongsID3 with data should match .JSON fix(subsonic): never omit duration for AlbumID3 (#5217) 2026-03-17 13:20:10 -04:00
Responses AlbumWithSongsID3 with data should match .XML fix(subsonic): never omit duration for AlbumID3 (#5217) 2026-03-17 13:20:10 -04:00
Responses AlbumWithSongsID3 without data should match .JSON fix(subsonic): never omit duration for AlbumID3 (#5217) 2026-03-17 13:20:10 -04:00
Responses AlbumWithSongsID3 without data should match .XML fix(subsonic): never omit duration for AlbumID3 (#5217) 2026-03-17 13:20:10 -04:00
Responses AlbumWithSongsID3 without data should match OpenSubsonic .JSON fix(subsonic): never omit duration for AlbumID3 (#5217) 2026-03-17 13:20:10 -04:00
Responses AlbumWithSongsID3 without data should match OpenSubsonic .XML fix(subsonic): never omit duration for AlbumID3 (#5217) 2026-03-17 13:20:10 -04:00
Responses Artist with data and MBID and Sort Name should match .JSON feat(bfr): Big Refactor: new scanner, lots of new fields and tags, improvements and DB schema changes (#2709) 2025-02-19 20:35:17 -05:00
Responses Artist with data and MBID and Sort Name should match .XML feat(bfr): Big Refactor: new scanner, lots of new fields and tags, improvements and DB schema changes (#2709) 2025-02-19 20:35:17 -05:00
Responses Artist with data should match .JSON chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses Artist with data should match .XML chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses Artist with OpenSubsonic data should match .JSON chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses Artist with OpenSubsonic data should match .XML chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses Artist without data should match .JSON chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses Artist without data should match .XML chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses ArtistInfo with data should match .JSON chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses ArtistInfo with data should match .XML chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses ArtistInfo without data should match .JSON chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses ArtistInfo without data should match .XML chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses Bookmarks with data should match .JSON feat: new "Subsonic Minimal Clients" configuration option (#4850) 2026-01-16 05:55:21 -05:00
Responses Bookmarks with data should match .XML feat: new "Subsonic Minimal Clients" configuration option (#4850) 2026-01-16 05:55:21 -05:00
Responses Bookmarks without data should match .JSON chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses Bookmarks without data should match .XML chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses Child with data should match .JSON fix(subsonic): always include mandatory title field in Child responses 2026-03-15 13:36:26 -04:00
Responses Child with data should match .XML fix(subsonic): always include mandatory title field in Child responses 2026-03-15 13:36:26 -04:00
Responses Child without data should match .JSON fix(subsonic): always include mandatory title field in Child responses 2026-03-15 13:36:26 -04:00
Responses Child without data should match .XML fix(subsonic): always include mandatory title field in Child responses 2026-03-15 13:36:26 -04:00
Responses Child without data should match OpenSubsonic .JSON fix(subsonic): always include mandatory title field in Child responses 2026-03-15 13:36:26 -04:00
Responses Child without data should match OpenSubsonic .XML fix(subsonic): always include mandatory title field in Child responses 2026-03-15 13:36:26 -04:00
Responses Directory with data should match .JSON feat: new "Subsonic Minimal Clients" configuration option (#4850) 2026-01-16 05:55:21 -05:00
Responses Directory with data should match .XML feat: new "Subsonic Minimal Clients" configuration option (#4850) 2026-01-16 05:55:21 -05:00
Responses Directory without data should match .JSON chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses Directory without data should match .XML chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses EmptyResponse should match .JSON chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses EmptyResponse should match .XML chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses Genres with data should match .JSON chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses Genres with data should match .XML chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses Genres without data should match .JSON chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses Genres without data should match .XML chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses Indexes with data should match .JSON chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses Indexes with data should match .XML chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses Indexes without data should match .JSON chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses Indexes without data should match .XML chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses InternetRadioStations with data should match .JSON chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses InternetRadioStations with data should match .XML chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses InternetRadioStations without data should match .JSON chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses InternetRadioStations without data should match .XML chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses License should match .JSON chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses License should match .XML chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses Lyrics with data should match .JSON chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses Lyrics with data should match .XML chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses Lyrics without data should match .JSON chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses Lyrics without data should match .XML chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses LyricsList with data should match .JSON chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses LyricsList with data should match .XML chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses LyricsList without data should match .JSON chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses LyricsList without data should match .XML chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses MusicFolders with data should match .JSON chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses MusicFolders with data should match .XML chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses MusicFolders without data should match .JSON chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses MusicFolders without data should match .XML chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses NowPlaying with data should match .JSON feat(subsonic): implement playbackReport OpenSubsonic extension (#5442) 2026-04-30 23:04:05 -04:00
Responses NowPlaying with data should match .XML feat(subsonic): implement playbackReport OpenSubsonic extension (#5442) 2026-04-30 23:04:05 -04:00
Responses NowPlaying without data should match .JSON feat(subsonic): implement playbackReport OpenSubsonic extension (#5442) 2026-04-30 23:04:05 -04:00
Responses NowPlaying without data should match .XML feat(subsonic): implement playbackReport OpenSubsonic extension (#5442) 2026-04-30 23:04:05 -04:00
Responses OpenSubsonicExtensions with data should match .JSON chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses OpenSubsonicExtensions with data should match .XML chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses OpenSubsonicExtensions without data should match .JSON chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses OpenSubsonicExtensions without data should match .XML chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses Playlists with data should match .JSON feat(subsonic): add OS readonly and validUntil properties in playlists (#4993) 2026-02-06 19:35:54 -05:00
Responses Playlists with data should match .XML fix(subsonic): restore public attribute for playlists in XML responses 2026-02-23 18:17:44 -05:00
Responses Playlists without data should match .JSON chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses Playlists without data should match .XML chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses PlayQueue with data should match .JSON feat: new "Subsonic Minimal Clients" configuration option (#4850) 2026-01-16 05:55:21 -05:00
Responses PlayQueue with data should match .XML feat: new "Subsonic Minimal Clients" configuration option (#4850) 2026-01-16 05:55:21 -05:00
Responses PlayQueue without data should match .JSON feat(subsonic): implement indexBasedQueue extension (#4244) 2025-11-09 12:52:05 -05:00
Responses PlayQueue without data should match .XML feat(subsonic): implement indexBasedQueue extension (#4244) 2025-11-09 12:52:05 -05:00
Responses PlayQueueByIndex with data should match .JSON feat: new "Subsonic Minimal Clients" configuration option (#4850) 2026-01-16 05:55:21 -05:00
Responses PlayQueueByIndex with data should match .XML feat: new "Subsonic Minimal Clients" configuration option (#4850) 2026-01-16 05:55:21 -05:00
Responses PlayQueueByIndex without data should match .JSON feat(subsonic): implement indexBasedQueue extension (#4244) 2025-11-09 12:52:05 -05:00
Responses PlayQueueByIndex without data should match .XML feat(subsonic): implement indexBasedQueue extension (#4244) 2025-11-09 12:52:05 -05:00
Responses ScanStatus with data should match .JSON chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses ScanStatus with data should match .XML chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses ScanStatus without data should match .JSON chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses ScanStatus without data should match .XML chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses Shares with data should match .JSON feat: new "Subsonic Minimal Clients" configuration option (#4850) 2026-01-16 05:55:21 -05:00
Responses Shares with data should match .XML feat: new "Subsonic Minimal Clients" configuration option (#4850) 2026-01-16 05:55:21 -05:00
Responses Shares with only required fields should match .JSON chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses Shares with only required fields should match .XML chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses Shares without data should match .JSON chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses Shares without data should match .XML chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses SimilarSongs with data should match .JSON feat: new "Subsonic Minimal Clients" configuration option (#4850) 2026-01-16 05:55:21 -05:00
Responses SimilarSongs with data should match .XML feat: new "Subsonic Minimal Clients" configuration option (#4850) 2026-01-16 05:55:21 -05:00
Responses SimilarSongs without data should match .JSON chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses SimilarSongs without data should match .XML chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses SimilarSongs2 with data should match .JSON feat: new "Subsonic Minimal Clients" configuration option (#4850) 2026-01-16 05:55:21 -05:00
Responses SimilarSongs2 with data should match .XML feat: new "Subsonic Minimal Clients" configuration option (#4850) 2026-01-16 05:55:21 -05:00
Responses SimilarSongs2 without data should match .JSON chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses SimilarSongs2 without data should match .XML chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses SonicMatches with data should match .JSON feat(subsonic): add sonicSimilarity extension as plugin capability (#5419) 2026-04-27 17:50:09 -04:00
Responses SonicMatches with data should match .XML feat(subsonic): add sonicSimilarity extension as plugin capability (#5419) 2026-04-27 17:50:09 -04:00
Responses SonicMatches without data should match .JSON feat(subsonic): add sonicSimilarity extension as plugin capability (#5419) 2026-04-27 17:50:09 -04:00
Responses SonicMatches without data should match .XML feat(subsonic): add sonicSimilarity extension as plugin capability (#5419) 2026-04-27 17:50:09 -04:00
Responses TopSongs with data should match .JSON feat: new "Subsonic Minimal Clients" configuration option (#4850) 2026-01-16 05:55:21 -05:00
Responses TopSongs with data should match .XML feat: new "Subsonic Minimal Clients" configuration option (#4850) 2026-01-16 05:55:21 -05:00
Responses TopSongs without data should match .JSON chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses TopSongs without data should match .XML chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses User with data should match .JSON chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses User with data should match .XML chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses User without data should match .JSON chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses User without data should match .XML chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses Users with data should match .JSON chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses Users with data should match .XML chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses Users without data should match .JSON chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses Users without data should match .XML chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00