Skip to content

Commit

Permalink
Fix #462: persist Skip Duplicates setting in add to playlist dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
dweymouth committed Aug 9, 2024
1 parent 4654d31 commit 66b878a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions backend/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ type AppConfig struct {
SavePlayQueue bool
SaveQueueToServer bool
DefaultPlaylistID string
AddToPlaylistSkipDuplicates bool
ShowTrackChangeNotification bool
EnableLrcLib bool
SkipSSLVerify bool
Expand Down
4 changes: 3 additions & 1 deletion ui/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,14 +271,16 @@ func (m *Controller) PromptForFirstServer() {
// Depending on the results of that dialog, potentially create a new playlist
// Add tracks to the user-specified playlist
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())
sp.SetOnDismiss(func() {
pop.Hide()
m.doModalClosed()
})
sp.SetOnNavigateTo(func(contentType mediaprovider.ContentType, id string) {
pop.Hide()
m.App.Config.Application.AddToPlaylistSkipDuplicates = sp.SkipDuplicates
if id == "" /* creating new playlist */ {
go m.App.ServerManager.Server.CreatePlaylist(sp.SearchDialog.SearchQuery(), trackIDs)
} else {
Expand Down
4 changes: 2 additions & 2 deletions ui/dialogs/selectplaylist.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ type SelectPlaylist struct {
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{
mp: mp,
loggedInUser: loggedInUser,
SkipDuplicates: false,
SkipDuplicates: skipDups,
}
sd := NewSearchDialog(
im,
Expand Down

0 comments on commit 66b878a

Please sign in to comment.