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
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:
@@ -394,3 +394,33 @@ SELECT ar.name AS artist_name, t.title
|
||||
WHERE t.id = ANY(sqlc.arg(ids)::uuid[])
|
||||
AND t.missing_since IS NOT NULL
|
||||
ORDER BY ar.name, t.title;
|
||||
|
||||
-- name: ListTopTracksForArtistName :many
|
||||
-- An artist's top songs for the Subsonic getTopSongs, which names the artist
|
||||
-- rather than giving an id; the name matches regardless of case. "Top" is
|
||||
-- this server's own listening: the songs played through most often (skips
|
||||
-- not counted) by everyone on it, then the most liked. Songs nobody has
|
||||
-- played or liked follow in album order, so an artist with no history still
|
||||
-- has songs to play. Missing files and the listener's quarantined songs are
|
||||
-- left out.
|
||||
SELECT sqlc.embed(t)
|
||||
FROM tracks t
|
||||
JOIN artists ar ON ar.id = t.artist_id
|
||||
JOIN albums al ON al.id = t.album_id
|
||||
LEFT JOIN LATERAL (
|
||||
SELECT count(*) AS plays FROM play_events pe
|
||||
WHERE pe.track_id = t.id AND pe.was_skipped = false
|
||||
) p ON true
|
||||
LEFT JOIN LATERAL (
|
||||
SELECT count(*) AS likes FROM general_likes gl WHERE gl.track_id = t.id
|
||||
) l ON true
|
||||
WHERE lower(ar.name) = lower(sqlc.arg(artist_name)::text)
|
||||
AND t.missing_since IS NULL
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM quarantine q
|
||||
WHERE q.user_id = sqlc.arg(user_id) AND q.track_id = t.id
|
||||
)
|
||||
ORDER BY p.plays DESC, l.likes DESC,
|
||||
al.release_date NULLS LAST, al.sort_title, al.id,
|
||||
t.disc_number NULLS FIRST, t.track_number NULLS FIRST, t.id
|
||||
LIMIT sqlc.arg(lim);
|
||||
|
||||
Reference in New Issue
Block a user