feat(subsonic): an artist's top songs, and the play queue carried between devices
release / go (push) Successful in 1m50s
release / web (push) Successful in 1m14s
release / govulncheck (push) Successful in 44s
release / integration (push) Successful in 4m11s
release / android (push) Successful in 6m15s
release / Build signed APK (push) Successful in 7m51s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Successful in 29s
release / Verify release artifacts (tag releases only) (push) Skipped

getTopSongs ranks the named artist's songs by how often they were played
through on this server, then by likes, then in album order, so an artist
nobody has played yet still has songs to offer. Missing files and the
listener's quarantined songs are left out.

savePlayQueue keeps one queue per listener: the songs in order, the one
playing, how far into it, and the app that saved it. getPlayQueue gives it
back to that listener only; a song no longer in the library drops out.
Saving no songs clears it. The queue lives in a new play_queues table,
which backups carry.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-25 17:03:29 -05:00
co-authored by Claude Opus 5.5
parent 8731e9695a
commit b801f81058
15 changed files with 568 additions and 2 deletions
@@ -0,0 +1,14 @@
-- The play queue a Subsonic app saves (savePlayQueue) so another app or
-- device can pick up where it left off (getPlayQueue): one queue per user,
-- the songs in order, the one playing and how far into it. track_ids is not
-- a foreign key: a song removed from the library drops out of the queue
-- when it is read, rather than blocking the removal.
CREATE TABLE play_queues (
user_id uuid PRIMARY KEY REFERENCES users(id) ON DELETE CASCADE,
track_ids uuid[] NOT NULL DEFAULT '{}',
current_track_id uuid,
position_ms bigint NOT NULL DEFAULT 0,
changed_at timestamptz NOT NULL DEFAULT now(),
-- The app that saved it, from the Subsonic c parameter.
changed_by text NOT NULL DEFAULT ''
);