feat: artist pictures in the web and Android apps
release / web (push) Successful in 1m59s
release / go (push) Successful in 2m23s
release / govulncheck (push) Successful in 22s
release / integration (push) Successful in 4m59s
release / android (push) Successful in 5m29s
release / Build signed APK (push) Successful in 6m26s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Successful in 31s
release / Verify release artifacts (tag releases only) (push) Skipped

Minstrel fetched artist pictures but showed them only to Subsonic apps.
GET /api/artists/{id}/image now serves the picture, or else the artist's
newest album cover, the same image Subsonic apps get. Artist listings
point at it when the artist has a picture and keep the album cover
otherwise; the artist page points at it whenever the artist has albums,
and the web artist page shows it beside the name.

Android shows the picture for cached artists that have one, and the
album cover for the rest.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-25 20:32:55 -05:00
co-authored by Claude Opus 5.5
parent 1965e82013
commit 7f7e946bad
12 changed files with 222 additions and 20 deletions
+25 -10
View File
@@ -85,26 +85,41 @@ func streamURLWithExt(trackID pgtype.UUID, ext string) string {
return streamURL(trackID) + "." + ext
}
// artistRefFrom projects a dbq.Artist into an ArtistRef without cover.
// albumCount must be pre-computed by the caller. Used by code paths that
// don't have a representative-album lookup at hand (artist detail, search,
// liked-artists list).
// artistImageURL returns the /api relative URL of an artist's image.
func artistImageURL(artistID pgtype.UUID) string {
return "/api/artists/" + uuidToString(artistID) + "/image"
}
// hasArtistPicture reports whether the artist-art providers fetched a
// picture for a.
func hasArtistPicture(a dbq.Artist) bool {
return a.ArtistThumbPath != nil && *a.ArtistThumbPath != ""
}
// artistRefFrom projects a dbq.Artist into an ArtistRef. albumCount must be
// pre-computed by the caller. CoverURL is the artist's picture when one was
// fetched, and empty otherwise: these code paths (artist detail, search,
// liked-artists list) have no representative-album lookup at hand.
func artistRefFrom(a dbq.Artist, albumCount int) ArtistRef {
return ArtistRef{
ref := ArtistRef{
ID: uuidToString(a.ID),
Name: a.Name,
SortName: a.SortName,
AlbumCount: albumCount,
}
if hasArtistPicture(a) {
ref.CoverURL = artistImageURL(a.ID)
}
return ref
}
// artistRefFromCovered projects a dbq.Artist into an ArtistRef with the
// derived CoverURL populated from a representative album id (nullable).
// Used by /api/home and /api/artists?sort=alpha which carry the lookup
// in the same query.
// artistRefFromCovered projects a dbq.Artist into an ArtistRef whose CoverURL
// is the artist's picture when one was fetched, or else the cover of a
// representative album id (nullable). Used by /api/home and
// /api/artists?sort=alpha, which carry the album lookup in the same query.
func artistRefFromCovered(a dbq.Artist, albumCount int, coverAlbumID pgtype.UUID) ArtistRef {
ref := artistRefFrom(a, albumCount)
if coverAlbumID.Valid {
if ref.CoverURL == "" && coverAlbumID.Valid {
ref.CoverURL = coverURL(coverAlbumID)
}
return ref