Skip to content

Commit

Permalink
Merge pull request #4 from xxxserxxx/add-artist-all
Browse files Browse the repository at this point in the history
'a' on artist name adds all artist music to queue.
  • Loading branch information
spezifisch authored Jul 30, 2024
2 parents 25f4b6e + 1f8448d commit d987718
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 8 deletions.
1 change: 1 addition & 0 deletions gui_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
20 changes: 12 additions & 8 deletions help_text.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
`

Expand Down
20 changes: 20 additions & 0 deletions page_browser.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions stmps.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,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)
Expand Down
1 change: 1 addition & 0 deletions widget_help.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit d987718

Please sign in to comment.