🎧 Your Personal Streaming Service
Go airsonicmadsonicmedia-servermusicmusic-servernavidromeopensubsonicraspberry-piself-hostedstreamerstreaming-apistreaming-audiosubsonicsubsonic-server
Add config option to show album participations under artists in Subsonic clients
Deluan136d5f9a8355
diff --git a/conf/configuration.go b/conf/configuration.goindex 93247d469..98ca5f268 100644--- a/conf/configuration.go+++ b/conf/configuration.go@@ -17,64 +17,61 @@ import ()type configOptions struct {- ConfigFile string- Address string- Port int- MusicFolder string- DataFolder string- DbPath string- LogLevel string- ScanInterval time.Duration- ScanSchedule string- SessionTimeout time.Duration- BaseURL string- UILoginBackgroundURL string- EnableTranscodingConfig bool- EnableDownloads bool- EnableExternalServices bool- EnableMediaFileCoverArt bool- TranscodingCacheSize string- ImageCacheSize string- AutoImportPlaylists bool- PlaylistsPath string- AutoTranscodeDownload bool-- SearchFullString bool- RecentlyAddedByModTime bool- IgnoredArticles string- IndexGroups string- ProbeCommand string- CoverArtPriority string- CoverJpegQuality int- UIWelcomeMessage string- EnableGravatar bool- EnableFavourites bool- EnableStarRating bool- EnableUserEditing bool- DefaultTheme string- DefaultLanguage string- DefaultUIVolume int- EnableCoverAnimation bool- GATrackingID string- EnableLogRedacting bool- AuthRequestLimit int- AuthWindowLength time.Duration- PasswordEncryptionKey string- ReverseProxyUserHeader string- ReverseProxyWhitelist string- Prometheus prometheusOptions- EnableReplayGain bool-- Scanner scannerOptions+ ConfigFile string+ Address string+ Port int+ MusicFolder string+ DataFolder string+ DbPath string+ LogLevel string+ ScanInterval time.Duration+ ScanSchedule string+ SessionTimeout time.Duration+ BaseURL string+ UILoginBackgroundURL string+ EnableTranscodingConfig bool+ EnableDownloads bool+ EnableExternalServices bool+ EnableMediaFileCoverArt bool+ TranscodingCacheSize string+ ImageCacheSize string+ AutoImportPlaylists bool+ PlaylistsPath string+ AutoTranscodeDownload bool+ DefaultDownsamplingFormat string+ SearchFullString bool+ RecentlyAddedByModTime bool+ IgnoredArticles string+ IndexGroups string+ SubsonicArtistParticipations bool+ ProbeCommand string+ CoverArtPriority string+ CoverJpegQuality int+ UIWelcomeMessage string+ EnableGravatar bool+ EnableFavourites bool+ EnableStarRating bool+ EnableUserEditing bool+ DefaultTheme string+ DefaultLanguage string+ DefaultUIVolume int+ EnableReplayGain bool+ EnableCoverAnimation bool+ GATrackingID string+ EnableLogRedacting bool+ AuthRequestLimit int+ AuthWindowLength time.Duration+ PasswordEncryptionKey string+ ReverseProxyUserHeader string+ ReverseProxyWhitelist string+ Prometheus prometheusOptions+ Scanner scannerOptionsAgents stringLastFM lastfmOptionsSpotify spotifyOptionsListenBrainz listenBrainzOptions- //test downsampling- DefaultDownsamplingFormat string-// DevFlags. These are used to enable/disable debugging and incomplete featuresDevLogSourceLine boolDevLogLevels map[string]string@@ -236,12 +233,12 @@ func init() {viper.SetDefault("enableexternalservices", true)viper.SetDefault("enableMediaFileCoverArt", true)viper.SetDefault("autotranscodedownload", false)-- // Config options only valid for file/env configuration+ viper.SetDefault("defaultdownsamplingformat", consts.DefaultDownsamplingFormat)viper.SetDefault("searchfullstring", false)viper.SetDefault("recentlyaddedbymodtime", false)viper.SetDefault("ignoredarticles", "The El La Los Las Le Les Os As O A")viper.SetDefault("indexgroups", "A B C D E F G H I J K L M N O P Q R S T U V W X-Z(XYZ) [Unknown]([)")+ viper.SetDefault("subsonicartistparticipations", false)viper.SetDefault("probecommand", "ffmpeg %s -f ffmetadata")viper.SetDefault("coverartpriority", "cover.*, folder.*, front.*, embedded, external")viper.SetDefault("coverjpegquality", 75)@@ -253,6 +250,7 @@ func init() {viper.SetDefault("defaulttheme", "Dark")viper.SetDefault("defaultlanguage", "")viper.SetDefault("defaultuivolume", consts.DefaultUIVolume)+ viper.SetDefault("enablereplaygain", false)viper.SetDefault("enablecoveranimation", true)viper.SetDefault("gatrackingid", "")viper.SetDefault("enablelogredacting", true)@@ -266,8 +264,6 @@ func init() {viper.SetDefault("prometheus.enabled", false)viper.SetDefault("prometheus.metricspath", "/metrics")- viper.SetDefault("enablereplaygain", false)-viper.SetDefault("scanner.extractor", consts.DefaultScannerExtractor)viper.SetDefault("scanner.genreseparators", ";/,")@@ -281,8 +277,6 @@ func init() {viper.SetDefault("listenbrainz.enabled", true)viper.SetDefault("listenbrainz.baseurl", "https://api.listenbrainz.org/1/")- viper.SetDefault("defaultdownsamplingformat", consts.DefaultDownsamplingFormat)-// DevFlags. These are used to enable/disable debugging and incomplete featuresviper.SetDefault("devlogsourceline", false)viper.SetDefault("devautocreateadminpassword", "")diff --git a/server/subsonic/browsing.go b/server/subsonic/browsing.goindex f9c48ac2e..f350757d3 100644--- a/server/subsonic/browsing.go+++ b/server/subsonic/browsing.go@@ -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))+ response := newResponse()+ response.ArtistWithAlbumsID3, err = api.buildArtist(r, artist)if err != nil {- log.Error(ctx, "Error retrieving albums by artist", "id", id, "name", artist.Name, err)- return nil, err+ log.Error(ctx, "Error retrieving albums by artist", "id", artist.ID, "name", artist.Name, err)}-- response := newResponse()- response.ArtistWithAlbumsID3 = api.buildArtist(r, artist, albums)- return response, nil+ 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.Artisreturn 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) {diff --git a/server/subsonic/filter/filters.go b/server/subsonic/filter/filters.goindex 8f05c42c4..fca482f33 100644--- a/server/subsonic/filter/filters.go+++ b/server/subsonic/filter/filters.go@@ -1,9 +1,11 @@package filterimport (+ "fmt""time""github.com/Masterminds/squirrel"+ "github.com/navidrome/navidrome/conf""github.com/navidrome/navidrome/model")@@ -49,9 +51,15 @@ func AlbumsByGenre(genre string) Options {}func AlbumsByArtistID(artistId string) Options {+ var filters squirrel.Sqlizer+ if conf.Server.SubsonicArtistParticipations {+ filters = squirrel.Like{"all_artist_ids": fmt.Sprintf("%%%s%%", artistId)}+ } else {+ filters = squirrel.Eq{"album_artist_id": artistId}+ }return Options{Sort: "max_year",- Filters: squirrel.Eq{"album_artist_id": artistId},+ Filters: filters,}}