fix(subsonic): answer what the OpenSubsonic spec and Subsonic apps require
- getOpenSubsonicExtensions answers, without credentials, as the spec requires of a server that says openSubsonic=true; it lists apiKeyAuthentication. An apiKey sent with u is error 43 and an unknown apiKey error 44, the extension's codes; a wrong key still counts toward the sign-in throttle. - search3 with an empty query (or two quote marks) matches everything, paged in a stable order, so apps that keep a copy of the library (Symfonium) can download it. A page of songs reads its albums and artists in two queries, not two per song. - getAlbumList2 serves type=starred and highest (the listener's liked albums) and byYear (oldest first, newest first for a backwards range). - Internet radio, podcasts, bookmarks, shares, chat and now-playing answer with an empty list instead of "Method not implemented", so an app shows an empty tab rather than an error. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -175,7 +175,7 @@ LIMIT sqlc.arg(lim) OFFSET sqlc.arg(off);
|
||||
-- name: SearchAlbums :many
|
||||
SELECT * FROM albums
|
||||
WHERE title ILIKE '%' || $1 || '%'
|
||||
ORDER BY sort_title
|
||||
ORDER BY sort_title, id
|
||||
LIMIT $2 OFFSET $3;
|
||||
|
||||
-- name: CountAlbumsMatching :one
|
||||
|
||||
@@ -27,7 +27,7 @@ SELECT * FROM artists ORDER BY sort_name;
|
||||
-- name: SearchArtists :many
|
||||
SELECT * FROM artists
|
||||
WHERE name ILIKE '%' || $1 || '%'
|
||||
ORDER BY sort_name
|
||||
ORDER BY sort_name, id
|
||||
LIMIT $2 OFFSET $3;
|
||||
|
||||
-- name: ListArtistsAlpha :many
|
||||
|
||||
@@ -144,3 +144,22 @@ JOIN LATERAL regexp_split_to_table(coalesce(tracks.genre, ''), '[;,]') AS g(genr
|
||||
WHERE tracks.artist_id = $1 AND trim(g.genre) <> ''
|
||||
AND tracks.missing_since IS NULL
|
||||
ORDER BY trim(g.genre);
|
||||
|
||||
-- name: ListAlbumsByYearOrdered :many
|
||||
-- Subsonic getAlbumList2 type=byYear: albums released within an inclusive
|
||||
-- year range, oldest first, or newest first when the caller asks for the
|
||||
-- range backwards (fromYear > toYear), as the Subsonic API defines it.
|
||||
SELECT albums.* FROM albums
|
||||
WHERE albums.release_date IS NOT NULL
|
||||
AND EXTRACT(YEAR FROM albums.release_date)::int
|
||||
BETWEEN LEAST(sqlc.arg(from_year)::int, sqlc.arg(to_year)::int)
|
||||
AND GREATEST(sqlc.arg(from_year)::int, sqlc.arg(to_year)::int)
|
||||
AND EXISTS (
|
||||
SELECT 1 FROM tracks
|
||||
WHERE tracks.album_id = albums.id
|
||||
AND tracks.missing_since IS NULL
|
||||
)
|
||||
ORDER BY CASE WHEN sqlc.arg(from_year)::int <= sqlc.arg(to_year)::int THEN albums.release_date END ASC,
|
||||
CASE WHEN sqlc.arg(from_year)::int > sqlc.arg(to_year)::int THEN albums.release_date END DESC,
|
||||
albums.sort_title, albums.id
|
||||
LIMIT sqlc.arg(lim) OFFSET sqlc.arg(off);
|
||||
|
||||
@@ -80,7 +80,7 @@ WHERE title ILIKE '%' || $1::text || '%'
|
||||
SELECT 1 FROM quarantine q
|
||||
WHERE q.user_id = $2 AND q.track_id = tracks.id
|
||||
)
|
||||
ORDER BY title
|
||||
ORDER BY title, id
|
||||
LIMIT $3 OFFSET $4;
|
||||
|
||||
-- name: CountTracksMatching :one
|
||||
|
||||
Reference in New Issue
Block a user