go fmt
This commit is contained in:
@@ -11,8 +11,8 @@ import (
|
|||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"time"
|
|
||||||
"slices"
|
"slices"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/dweymouth/supersonic/backend"
|
"github.com/dweymouth/supersonic/backend"
|
||||||
"github.com/dweymouth/supersonic/backend/mediaprovider"
|
"github.com/dweymouth/supersonic/backend/mediaprovider"
|
||||||
@@ -346,20 +346,20 @@ func (m *Controller) DoAddTracksToPlaylistWorkflow(trackIDs []string) {
|
|||||||
log.Printf("error getting playlist: %s", err.Error())
|
log.Printf("error getting playlist: %s", err.Error())
|
||||||
} else {
|
} else {
|
||||||
var trackIDsInPaylist []string
|
var trackIDsInPaylist []string
|
||||||
|
|
||||||
for _, track := range selectedPlaylist.Tracks{
|
for _, track := range selectedPlaylist.Tracks {
|
||||||
trackIDsInPaylist = append(trackIDsInPaylist, track.ID)
|
trackIDsInPaylist = append(trackIDsInPaylist, track.ID)
|
||||||
}
|
}
|
||||||
filterTrackIDs = sharedutil.FilterSlice(trackIDs, func(trackID string) bool {
|
filterTrackIDs = sharedutil.FilterSlice(trackIDs, func(trackID string) bool {
|
||||||
return !slices.Contains(trackIDsInPaylist, trackID)
|
return !slices.Contains(trackIDsInPaylist, trackID)
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
m.App.ServerManager.Server.AddPlaylistTracks(id, filterTrackIDs)
|
m.App.ServerManager.Server.AddPlaylistTracks(id, filterTrackIDs)
|
||||||
}()
|
}()
|
||||||
} else {
|
} else {
|
||||||
go m.App.ServerManager.Server.AddPlaylistTracks(id, trackIDs)
|
go m.App.ServerManager.Server.AddPlaylistTracks(id, trackIDs)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|||||||
+10
-11
@@ -33,8 +33,8 @@ type SearchDialog struct {
|
|||||||
list *widget.List
|
list *widget.List
|
||||||
selectedIndex int
|
selectedIndex int
|
||||||
|
|
||||||
placeholderTitle string
|
placeholderTitle string
|
||||||
content *fyne.Container
|
content *fyne.Container
|
||||||
|
|
||||||
OnDismiss func()
|
OnDismiss func()
|
||||||
OnNavigateTo func(mediaprovider.ContentType, string, string)
|
OnNavigateTo func(mediaprovider.ContentType, string, string)
|
||||||
@@ -142,7 +142,7 @@ func (sd *SearchDialog) setResults(results []*mediaprovider.SearchResult) {
|
|||||||
|
|
||||||
func (sd *SearchDialog) SetContent(checkBox *widget.Check) {
|
func (sd *SearchDialog) SetContent(checkBox *widget.Check) {
|
||||||
dismissBtn := widget.NewButton("Close", sd.onDismiss)
|
dismissBtn := widget.NewButton("Close", sd.onDismiss)
|
||||||
title := widget.NewRichText(&widget.TextSegment{Text:sd.placeholderTitle, Style: util.BoldRichTextStyle})
|
title := widget.NewRichText(&widget.TextSegment{Text: sd.placeholderTitle, Style: util.BoldRichTextStyle})
|
||||||
title.Segments[0].(*widget.TextSegment).Style.Alignment = fyne.TextAlignCenter
|
title.Segments[0].(*widget.TextSegment).Style.Alignment = fyne.TextAlignCenter
|
||||||
se := sd.SearchEntry.(fyne.CanvasObject)
|
se := sd.SearchEntry.(fyne.CanvasObject)
|
||||||
if checkBox != nil {
|
if checkBox != nil {
|
||||||
@@ -155,15 +155,14 @@ func (sd *SearchDialog) SetContent(checkBox *widget.Check) {
|
|||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
sd.content = container.NewStack(
|
sd.content = container.NewStack(
|
||||||
container.NewBorder(
|
container.NewBorder(
|
||||||
container.NewVBox(title, se),
|
container.NewVBox(title, se),
|
||||||
container.NewVBox(widget.NewSeparator(), container.NewHBox(layout.NewSpacer(), dismissBtn)),
|
container.NewVBox(widget.NewSeparator(), container.NewHBox(layout.NewSpacer(), dismissBtn)),
|
||||||
nil, nil, sd.list),
|
nil, nil, sd.list),
|
||||||
container.NewCenter(sd.loadingDots),
|
container.NewCenter(sd.loadingDots),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func (sd *SearchDialog) onInit() {
|
func (sd *SearchDialog) onInit() {
|
||||||
if sd.OnInit == nil {
|
if sd.OnInit == nil {
|
||||||
@@ -180,7 +179,7 @@ func (sd *SearchDialog) onInit() {
|
|||||||
}
|
}
|
||||||
sd.SetContent(checkBox)
|
sd.SetContent(checkBox)
|
||||||
sd.loadingDots.Stop()
|
sd.loadingDots.Stop()
|
||||||
sd.setResults(results)
|
sd.setResults(results)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (sd *SearchDialog) onSearched(query string) {
|
func (sd *SearchDialog) onSearched(query string) {
|
||||||
|
|||||||
@@ -16,18 +16,18 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type SelectPlaylist struct {
|
type SelectPlaylist struct {
|
||||||
SearchDialog *SearchDialog
|
SearchDialog *SearchDialog
|
||||||
mp mediaprovider.MediaProvider
|
mp mediaprovider.MediaProvider
|
||||||
loggedInUser string
|
loggedInUser string
|
||||||
allPlaylists []*mediaprovider.Playlist
|
allPlaylists []*mediaprovider.Playlist
|
||||||
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) *SelectPlaylist {
|
||||||
|
|
||||||
sp := &SelectPlaylist{
|
sp := &SelectPlaylist{
|
||||||
mp: mp,
|
mp: mp,
|
||||||
loggedInUser: loggedInUser,
|
loggedInUser: loggedInUser,
|
||||||
SkipDuplicates: false,
|
SkipDuplicates: false,
|
||||||
}
|
}
|
||||||
sd := NewSearchDialog(
|
sd := NewSearchDialog(
|
||||||
|
|||||||
Reference in New Issue
Block a user