feat: imported playlists are public by default (#3143)

* feat: imported playlists are public by default

* chore: make linter happy

---------

Co-authored-by: John White <john@activecode.dev>
This commit is contained in:
John White
2024-08-29 01:20:05 +02:00
committed by GitHub
parent 9f65f8f5a8
commit 67d11dd144
2 changed files with 72 additions and 67 deletions
+2
View File
@@ -47,6 +47,7 @@ type configOptions struct {
AlbumPlayCountMode string AlbumPlayCountMode string
EnableArtworkPrecache bool EnableArtworkPrecache bool
AutoImportPlaylists bool AutoImportPlaylists bool
DefaultPlaylistPublicVisibility bool
PlaylistsPath string PlaylistsPath string
AutoTranscodeDownload bool AutoTranscodeDownload bool
DefaultDownsamplingFormat string DefaultDownsamplingFormat string
@@ -299,6 +300,7 @@ func init() {
viper.SetDefault("albumplaycountmode", consts.AlbumPlayCountModeAbsolute) viper.SetDefault("albumplaycountmode", consts.AlbumPlayCountModeAbsolute)
viper.SetDefault("enableartworkprecache", true) viper.SetDefault("enableartworkprecache", true)
viper.SetDefault("autoimportplaylists", true) viper.SetDefault("autoimportplaylists", true)
viper.SetDefault("defaultplaylistpublicvisibility", true)
viper.SetDefault("playlistspath", consts.DefaultPlaylistsPath) viper.SetDefault("playlistspath", consts.DefaultPlaylistsPath)
viper.SetDefault("enabledownloads", true) viper.SetDefault("enabledownloads", true)
viper.SetDefault("enableexternalservices", true) viper.SetDefault("enableexternalservices", true)
+3
View File
@@ -14,6 +14,8 @@ import (
"strings" "strings"
"time" "time"
"github.com/navidrome/navidrome/conf"
"github.com/RaveNoX/go-jsoncommentstrip" "github.com/RaveNoX/go-jsoncommentstrip"
"github.com/navidrome/navidrome/log" "github.com/navidrome/navidrome/log"
"github.com/navidrome/navidrome/model" "github.com/navidrome/navidrome/model"
@@ -193,6 +195,7 @@ func (s *playlists) updatePlaylist(ctx context.Context, newPls *model.Playlist)
} else { } else {
log.Info(ctx, "Adding synced playlist", "playlist", newPls.Name, "path", newPls.Path, "owner", owner.UserName) log.Info(ctx, "Adding synced playlist", "playlist", newPls.Name, "path", newPls.Path, "owner", owner.UserName)
newPls.OwnerID = owner.ID newPls.OwnerID = owner.ID
newPls.Public = conf.Server.DefaultPlaylistPublicVisibility
} }
return s.ds.Playlist(ctx).Put(newPls) return s.ds.Playlist(ctx).Put(newPls)
} }