Add config option to show album participations under artists in Subsonic clients
This commit is contained in:
+14
-10
@@ -141,15 +141,12 @@ func (api *Router) GetArtist(r *http.Request) (*responses.Subsonic, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
albums, err := api.ds.Album(ctx).GetAllWithoutGenres(filter.AlbumsByArtistID(id))
|
||||
if err != nil {
|
||||
log.Error(ctx, "Error retrieving albums by artist", "id", id, "name", artist.Name, err)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
response := newResponse()
|
||||
response.ArtistWithAlbumsID3 = api.buildArtist(r, artist, albums)
|
||||
return response, nil
|
||||
response.ArtistWithAlbumsID3, err = api.buildArtist(r, artist)
|
||||
if err != nil {
|
||||
log.Error(ctx, "Error retrieving albums by artist", "id", artist.ID, "name", artist.Name, err)
|
||||
}
|
||||
return response, err
|
||||
}
|
||||
|
||||
func (api *Router) GetAlbum(r *http.Request) (*responses.Subsonic, error) {
|
||||
@@ -370,11 +367,18 @@ func (api *Router) buildArtistDirectory(ctx context.Context, artist *model.Artis
|
||||
return dir, nil
|
||||
}
|
||||
|
||||
func (api *Router) buildArtist(r *http.Request, artist *model.Artist, albums model.Albums) *responses.ArtistWithAlbumsID3 {
|
||||
func (api *Router) buildArtist(r *http.Request, artist *model.Artist) (*responses.ArtistWithAlbumsID3, error) {
|
||||
ctx := r.Context()
|
||||
a := &responses.ArtistWithAlbumsID3{}
|
||||
a.ArtistID3 = toArtistID3(r, *artist)
|
||||
|
||||
albums, err := api.ds.Album(ctx).GetAllWithoutGenres(filter.AlbumsByArtistID(artist.ID))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
a.Album = childrenFromAlbums(r.Context(), albums)
|
||||
return a
|
||||
return a, nil
|
||||
}
|
||||
|
||||
func (api *Router) buildAlbumDirectory(ctx context.Context, album *model.Album) (*responses.Directory, error) {
|
||||
|
||||
Reference in New Issue
Block a user