From 1f8448d50bb40c5f1d519e6969b86822bd1cc464 Mon Sep 17 00:00:00 2001 From: "Sean E. Russell" Date: Wed, 15 May 2024 07:48:44 -0500 Subject: [PATCH] 'a' on artist name adds all artist music to queue. While updating help text for feature: since not all keys work in both tabs in the browser, clarifies this in help text. --- gui_handlers.go | 1 + help_text.go | 20 ++++++++++++-------- page_browser.go | 20 ++++++++++++++++++++ stmps.go | 1 + widget_help.go | 1 + 5 files changed, 35 insertions(+), 8 deletions(-) diff --git a/gui_handlers.go b/gui_handlers.go index 9a3990b..d3864c7 100644 --- a/gui_handlers.go +++ b/gui_handlers.go @@ -75,6 +75,7 @@ func (ui *Ui) handlePageInput(event *tcell.EventKey) *tcell.EventKey { } return nil + // TODO (A) volume up with '+'; trivial, but needs to be a different patch so adding note case '=': // volume+ if err := ui.player.AdjustVolume(5); err != nil { diff --git a/help_text.go b/help_text.go index 645b525..e51a14c 100644 --- a/help_text.go +++ b/help_text.go @@ -10,14 +10,18 @@ r add 50 random songs to queue ` const helpPageBrowser = ` -ENTER play song (clears current queue) -a add album or song to queue -A add song to playlist -y toggle star on song/album -R refresh the list -/ Search artists -n Continue search forward -N Continue search backwards +artist tab + R refresh the list + / Search artists + a Add all artist songs to queue + n Continue search forward + N Continue search backwards +song tab + ENTER play song (clears current queue) + a add album or song to queue + A add song to playlist + y toggle star on song/album + R refresh the list ESC Close search ` diff --git a/page_browser.go b/page_browser.go index 6717b06..9febcca 100644 --- a/page_browser.go +++ b/page_browser.go @@ -98,6 +98,9 @@ func (ui *Ui) createBrowserPage(indexes *[]subsonic.SubsonicIndex) *BrowserPage } switch event.Rune() { + case 'a': + browserPage.handleAddArtistToQueue() + return nil case '/': browserPage.showSearchField(true) browserPage.search() @@ -235,6 +238,23 @@ func (b *BrowserPage) UpdateStars() { } } +func (b *BrowserPage) handleAddArtistToQueue() { + currentIndex := b.artistList.GetCurrentItem() + if currentIndex < 0 { + return + } + + for _, entity := range b.currentDirectory.Entities { + if entity.IsDirectory { + b.addDirectoryToQueue(&entity) + } else { + b.ui.addSongToQueue(&entity) + } + } + + b.ui.queuePage.UpdateQueue() +} + func (b *BrowserPage) handleAddEntityToQueue() { currentIndex := b.entityList.GetCurrentItem() if currentIndex < 0 { diff --git a/stmps.go b/stmps.go index 3d63985..a432e78 100644 --- a/stmps.go +++ b/stmps.go @@ -64,6 +64,7 @@ func main() { fmt.Printf("Error fetching indexes from server: %s\n", err) os.Exit(1) } + // TODO (B) loading playlists can take a long time on e.g. gonic if there are a lot of them; can it be done in the background? playlistResponse, err := connection.GetPlaylists() if err != nil { fmt.Printf("Error fetching indexes from server: %s\n", err) diff --git a/widget_help.go b/widget_help.go index 69487b3..f427770 100644 --- a/widget_help.go +++ b/widget_help.go @@ -6,6 +6,7 @@ import ( "github.com/rivo/tview" ) +// FIXME (A) invoking help and the dismissing it ('q') dismisses it forever (it can't be called back up) type HelpWidget struct { Root *tview.Flex