feat(subsonic): add getStarred and getStarred2 handlers

Both return user's starred artists/albums/songs sorted liked_at DESC.
Cap at 500 entries per category for v1 (Subsonic spec doesn't define
pagination on these endpoints; M3+ can revisit if needed).
This commit is contained in:
2026-04-26 16:45:04 -04:00
parent 32fb3fec20
commit c7f4adbcc3
4 changed files with 194 additions and 0 deletions
+28
View File
@@ -211,6 +211,34 @@ type SearchResult3Response struct {
SearchResult3 SearchResult3Container `json:"searchResult3" xml:"searchResult3"`
}
// StarredContainer is the body of getStarred / getStarred2.
type StarredContainer struct {
XMLName xml.Name `json:"-" xml:"starred2"`
Artists []ArtistRef `json:"artist" xml:"artist"`
Albums []AlbumRef `json:"album" xml:"album"`
Songs []SongRef `json:"song" xml:"song"`
}
type GetStarred2Response struct {
Envelope
Starred2 StarredContainer `json:"starred2" xml:"starred2"`
}
// GetStarredContainer mirrors getStarred (id3-less variant). Response uses
// the same shape; the only material difference from getStarred2 is the
// outer key name.
type GetStarredContainer struct {
XMLName xml.Name `json:"-" xml:"starred"`
Artists []ArtistRef `json:"artist" xml:"artist"`
Albums []AlbumRef `json:"album" xml:"album"`
Songs []SongRef `json:"song" xml:"song"`
}
type GetStarredResponse struct {
Envelope
Starred GetStarredContainer `json:"starred" xml:"starred"`
}
// ---- conversion helpers ----
func artistRef(a dbq.Artist, albumCount int) ArtistRef {