Fix #462: persist Skip Duplicates setting in add to playlist dialog

This commit is contained in:
Drew Weymouth
2024-08-09 07:35:55 -07:00
parent 4654d310fd
commit 66b878a092
3 changed files with 6 additions and 3 deletions
+1
View File
@@ -44,6 +44,7 @@ type AppConfig struct {
SavePlayQueue bool SavePlayQueue bool
SaveQueueToServer bool SaveQueueToServer bool
DefaultPlaylistID string DefaultPlaylistID string
AddToPlaylistSkipDuplicates bool
ShowTrackChangeNotification bool ShowTrackChangeNotification bool
EnableLrcLib bool EnableLrcLib bool
SkipSSLVerify bool SkipSSLVerify bool
+3 -1
View File
@@ -271,7 +271,8 @@ func (m *Controller) PromptForFirstServer() {
// Depending on the results of that dialog, potentially create a new playlist // Depending on the results of that dialog, potentially create a new playlist
// Add tracks to the user-specified playlist // Add tracks to the user-specified playlist
func (m *Controller) DoAddTracksToPlaylistWorkflow(trackIDs []string) { func (m *Controller) DoAddTracksToPlaylistWorkflow(trackIDs []string) {
sp := dialogs.NewSelectPlaylistDialog(m.App.ServerManager.Server, m.App.ImageManager, m.App.ServerManager.LoggedInUser) sp := dialogs.NewSelectPlaylistDialog(m.App.ServerManager.Server, m.App.ImageManager,
m.App.ServerManager.LoggedInUser, m.App.Config.Application.AddToPlaylistSkipDuplicates)
pop := widget.NewModalPopUp(sp.SearchDialog, m.MainWindow.Canvas()) pop := widget.NewModalPopUp(sp.SearchDialog, m.MainWindow.Canvas())
sp.SetOnDismiss(func() { sp.SetOnDismiss(func() {
pop.Hide() pop.Hide()
@@ -279,6 +280,7 @@ func (m *Controller) DoAddTracksToPlaylistWorkflow(trackIDs []string) {
}) })
sp.SetOnNavigateTo(func(contentType mediaprovider.ContentType, id string) { sp.SetOnNavigateTo(func(contentType mediaprovider.ContentType, id string) {
pop.Hide() pop.Hide()
m.App.Config.Application.AddToPlaylistSkipDuplicates = sp.SkipDuplicates
if id == "" /* creating new playlist */ { if id == "" /* creating new playlist */ {
go m.App.ServerManager.Server.CreatePlaylist(sp.SearchDialog.SearchQuery(), trackIDs) go m.App.ServerManager.Server.CreatePlaylist(sp.SearchDialog.SearchQuery(), trackIDs)
} else { } else {
+2 -2
View File
@@ -24,11 +24,11 @@ type SelectPlaylist struct {
SkipDuplicates bool SkipDuplicates bool
} }
func NewSelectPlaylistDialog(mp mediaprovider.MediaProvider, im util.ImageFetcher, loggedInUser string) *SelectPlaylist { func NewSelectPlaylistDialog(mp mediaprovider.MediaProvider, im util.ImageFetcher, loggedInUser string, skipDups bool) *SelectPlaylist {
sp := &SelectPlaylist{ sp := &SelectPlaylist{
mp: mp, mp: mp,
loggedInUser: loggedInUser, loggedInUser: loggedInUser,
SkipDuplicates: false, SkipDuplicates: skipDups,
} }
sd := NewSearchDialog( sd := NewSearchDialog(
im, im,