Skip to content

Commit

Permalink
Use Navidrome's own public images endpoint for getAlbumInfo's image…
Browse files Browse the repository at this point in the history
…URLs
  • Loading branch information
deluan committed Feb 9, 2023
1 parent 8067137 commit b0e58cb
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
13 changes: 7 additions & 6 deletions server/subsonic/browsing.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,10 @@ func (api *Router) GetAlbumInfo(r *http.Request) (*responses.Subsonic, error) {
response := newResponse()
response.AlbumInfo = &responses.AlbumInfo{}
response.AlbumInfo.Notes = album.Description
response.AlbumInfo.SmallImageUrl = album.SmallImageUrl
response.AlbumInfo.MediumImageUrl = album.MediumImageUrl
response.AlbumInfo.LargeImageUrl = album.LargeImageUrl
response.AlbumInfo.SmallImageUrl = public.ImageURL(r, album.CoverArtID(), 150)
response.AlbumInfo.MediumImageUrl = public.ImageURL(r, album.CoverArtID(), 300)
response.AlbumInfo.LargeImageUrl = public.ImageURL(r, album.CoverArtID(), 600)

response.AlbumInfo.LastFmUrl = album.ExternalUrl
response.AlbumInfo.MusicBrainzID = album.MbzAlbumID

Expand Down Expand Up @@ -257,9 +258,9 @@ func (api *Router) GetArtistInfo(r *http.Request) (*responses.Subsonic, error) {
response := newResponse()
response.ArtistInfo = &responses.ArtistInfo{}
response.ArtistInfo.Biography = artist.Biography
response.ArtistInfo.SmallImageUrl = public.ImageURL(r, artist.CoverArtID(), 160)
response.ArtistInfo.MediumImageUrl = public.ImageURL(r, artist.CoverArtID(), 320)
response.ArtistInfo.LargeImageUrl = public.ImageURL(r, artist.CoverArtID(), 0)
response.ArtistInfo.SmallImageUrl = public.ImageURL(r, artist.CoverArtID(), 150)
response.ArtistInfo.MediumImageUrl = public.ImageURL(r, artist.CoverArtID(), 300)
response.ArtistInfo.LargeImageUrl = public.ImageURL(r, artist.CoverArtID(), 600)
response.ArtistInfo.LastFmUrl = artist.ExternalUrl
response.ArtistInfo.MusicBrainzID = artist.MbzArtistID
for _, s := range artist.SimilarArtists {
Expand Down
4 changes: 2 additions & 2 deletions server/subsonic/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func toArtist(r *http.Request, a model.Artist) responses.Artist {
AlbumCount: a.AlbumCount,
UserRating: a.Rating,
CoverArt: a.CoverArtID().String(),
ArtistImageUrl: public.ImageURL(r, a.CoverArtID(), 0),
ArtistImageUrl: public.ImageURL(r, a.CoverArtID(), 600),
}
if a.Starred {
artist.Starred = &a.StarredAt
Expand All @@ -102,7 +102,7 @@ func toArtistID3(r *http.Request, a model.Artist) responses.ArtistID3 {
Name: a.Name,
AlbumCount: a.AlbumCount,
CoverArt: a.CoverArtID().String(),
ArtistImageUrl: public.ImageURL(r, a.CoverArtID(), 0),
ArtistImageUrl: public.ImageURL(r, a.CoverArtID(), 600),
UserRating: a.Rating,
}
if a.Starred {
Expand Down
2 changes: 1 addition & 1 deletion server/subsonic/searching.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func (api *Router) Search2(r *http.Request) (*responses.Subsonic, error) {
AlbumCount: artist.AlbumCount,
UserRating: artist.Rating,
CoverArt: artist.CoverArtID().String(),
ArtistImageUrl: public.ImageURL(r, artist.CoverArtID(), 0),
ArtistImageUrl: public.ImageURL(r, artist.CoverArtID(), 600),
}
if artist.Starred {
searchResult2.Artist[i].Starred = &as[i].StarredAt
Expand Down

0 comments on commit b0e58cb

Please sign in to comment.