diff --git a/conf/configuration.go b/conf/configuration.go index d5e9b407b..88e1838fc 100644 --- a/conf/configuration.go +++ b/conf/configuration.go @@ -59,8 +59,6 @@ type configOptions struct { PreferSortTags bool IgnoredArticles string IndexGroups string - SubsonicArtistParticipations bool - DefaultReportRealPath bool FFmpegPath string MPVPath string MPVCmdTemplate string @@ -93,6 +91,7 @@ type configOptions struct { Backup backupOptions PID pidOptions Inspect inspectOptions + Subsonic subsonicOptions Agents string LastFM lastfmOptions @@ -121,7 +120,6 @@ type configOptions struct { DevScannerThreads uint DevInsightsInitialDelay time.Duration DevEnablePlayerInsights bool - DevOpenSubsonicDisabledClients string } type scannerOptions struct { @@ -133,6 +131,12 @@ type scannerOptions struct { GroupAlbumReleases bool // Deprecated: BFR Update docs } +type subsonicOptions struct { + ArtistParticipations bool + DefaultReportRealPath bool + LegacyClients string +} + type TagConf struct { Aliases []string `yaml:"aliases"` Type string `yaml:"type"` @@ -431,8 +435,6 @@ func init() { viper.SetDefault("prefersorttags", 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("defaultreportrealpath", false) viper.SetDefault("ffmpegpath", "") viper.SetDefault("mpvcmdtemplate", "mpv --audio-device=%d --no-audio-display --pause %f --input-ipc-server=%s") @@ -477,6 +479,10 @@ func init() { viper.SetDefault("scanner.watcherwait", consts.DefaultWatcherWait) viper.SetDefault("scanner.scanonstartup", true) + viper.SetDefault("subsonic.artistparticipations", false) + viper.SetDefault("subsonic.defaultreportrealpath", false) + viper.SetDefault("subsonic.legacyclients", "DSub") + viper.SetDefault("agents", "lastfm,spotify") viper.SetDefault("lastfm.enabled", true) viper.SetDefault("lastfm.language", "en") @@ -521,7 +527,6 @@ func init() { viper.SetDefault("devscannerthreads", 5) viper.SetDefault("devinsightsinitialdelay", consts.InsightsInitialDelay) viper.SetDefault("devenableplayerinsights", true) - viper.SetDefault("devopensubsonicdisabledclients", "DSub") } func InitConfig(cfgFile string) { diff --git a/core/players.go b/core/players.go index 1cba4893b..963914514 100644 --- a/core/players.go +++ b/core/players.go @@ -53,7 +53,7 @@ func (p *players) Register(ctx context.Context, playerID, client, userAgent, ip UserId: user.ID, Client: client, ScrobbleEnabled: true, - ReportRealPath: conf.Server.DefaultReportRealPath, + ReportRealPath: conf.Server.Subsonic.DefaultReportRealPath, } log.Info(ctx, "Registering new player", "id", plr.ID, "client", client, "username", username, "type", userAgent) } diff --git a/server/subsonic/filter/filters.go b/server/subsonic/filter/filters.go index b50f99029..1cac0b674 100644 --- a/server/subsonic/filter/filters.go +++ b/server/subsonic/filter/filters.go @@ -50,7 +50,7 @@ func AlbumsByArtistID(artistId string) Options { filters := []Sqlizer{ persistence.Exists("json_tree(Participants, '$.albumartist')", Eq{"value": artistId}), } - if conf.Server.SubsonicArtistParticipations { + if conf.Server.Subsonic.ArtistParticipations { filters = append(filters, persistence.Exists("json_tree(Participants, '$.artist')", Eq{"value": artistId}), ) diff --git a/server/subsonic/helpers.go b/server/subsonic/helpers.go index bb6f2dfd4..01d876d19 100644 --- a/server/subsonic/helpers.go +++ b/server/subsonic/helpers.go @@ -110,7 +110,7 @@ func toArtistID3(r *http.Request, a model.Artist) responses.ArtistID3 { func toOSArtistID3(ctx context.Context, a model.Artist) *responses.OpenSubsonicArtistID3 { player, _ := request.PlayerFrom(ctx) - if strings.Contains(conf.Server.DevOpenSubsonicDisabledClients, player.Client) { + if strings.Contains(conf.Server.Subsonic.LegacyClients, player.Client) { return nil } artist := responses.OpenSubsonicArtistID3{ @@ -197,7 +197,7 @@ func childFromMediaFile(ctx context.Context, mf model.MediaFile) responses.Child func osChildFromMediaFile(ctx context.Context, mf model.MediaFile) *responses.OpenSubsonicChild { player, _ := request.PlayerFrom(ctx) - if strings.Contains(conf.Server.DevOpenSubsonicDisabledClients, player.Client) { + if strings.Contains(conf.Server.Subsonic.LegacyClients, player.Client) { return nil } child := responses.OpenSubsonicChild{} @@ -301,7 +301,7 @@ func childFromAlbum(ctx context.Context, al model.Album) responses.Child { func osChildFromAlbum(ctx context.Context, al model.Album) *responses.OpenSubsonicChild { player, _ := request.PlayerFrom(ctx) - if strings.Contains(conf.Server.DevOpenSubsonicDisabledClients, player.Client) { + if strings.Contains(conf.Server.Subsonic.LegacyClients, player.Client) { return nil } child := responses.OpenSubsonicChild{} @@ -376,7 +376,7 @@ func buildAlbumID3(ctx context.Context, album model.Album) responses.AlbumID3 { func buildOSAlbumID3(ctx context.Context, album model.Album) *responses.OpenSubsonicAlbumID3 { player, _ := request.PlayerFrom(ctx) - if strings.Contains(conf.Server.DevOpenSubsonicDisabledClients, player.Client) { + if strings.Contains(conf.Server.Subsonic.LegacyClients, player.Client) { return nil } dir := responses.OpenSubsonicAlbumID3{}