aboutsummaryrefslogtreecommitdiff
path: root/src/page_artists.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/page_artists.go')
-rw-r--r--src/page_artists.go19
1 files changed, 8 insertions, 11 deletions
diff --git a/src/page_artists.go b/src/page_artists.go
index 6cbaee1..874a675 100644
--- a/src/page_artists.go
+++ b/src/page_artists.go
@@ -47,6 +47,7 @@ func (a *app) artistsPage() tview.Primitive {
47 a.artistsTree.SetInputCapture(func(event *tcell.EventKey) *tcell.EventKey { 47 a.artistsTree.SetInputCapture(func(event *tcell.EventKey) *tcell.EventKey {
48 if event.Key() == tcell.KeyLeft || event.Key() == tcell.KeyRight { 48 if event.Key() == tcell.KeyLeft || event.Key() == tcell.KeyRight {
49 a.tv.SetFocus(a.songsList) 49 a.tv.SetFocus(a.songsList)
50 a.updateFooter()
50 return nil 51 return nil
51 } 52 }
52 return event 53 return event
@@ -55,6 +56,7 @@ func (a *app) artistsPage() tview.Primitive {
55 a.songsList.SetInputCapture(func(event *tcell.EventKey) *tcell.EventKey { 56 a.songsList.SetInputCapture(func(event *tcell.EventKey) *tcell.EventKey {
56 if event.Key() == tcell.KeyLeft || event.Key() == tcell.KeyRight { 57 if event.Key() == tcell.KeyLeft || event.Key() == tcell.KeyRight {
57 a.tv.SetFocus(a.artistsTree) 58 a.tv.SetFocus(a.artistsTree)
59 a.updateFooter()
58 return nil 60 return nil
59 } 61 }
60 return event 62 return event
@@ -112,22 +114,17 @@ func (a *app) loadAlbumInPanel(id string) error {
112 return err 114 return err
113 } 115 }
114 116
115 var songs []*subsonic.Child
116
117 a.songsList.Clear() 117 a.songsList.Clear()
118 for i := len(album.Child) - 1; i >= 0; i-- { 118 a.currentSongs = make([]*subsonic.Child, 0)
119 song := album.Child[i] 119 for _, song := range album.Child {
120 songNoPtr := *song 120 a.currentSongs = append(a.currentSongs, song)
121 songs = append([]*subsonic.Child{&songNoPtr}, songs...)
122
123 songsCopy := make([]*subsonic.Child, len(songs))
124 copy(songsCopy, songs)
125 121
126 txt := fmt.Sprintf("%-2d - %s", song.Track, song.Title) 122 txt := fmt.Sprintf("%-2d - %s", song.Track, song.Title)
127 123
128 a.songsList.InsertItem(0, txt, "", 0, func() { 124 a.songsList.AddItem(txt, "", 0, func() {
125 sel := a.songsList.GetCurrentItem()
129 a.playQueue.Clear() 126 a.playQueue.Clear()
130 for _, s := range songsCopy { 127 for _, s := range a.currentSongs[sel:] {
131 a.playQueue.Append(s) 128 a.playQueue.Append(s)
132 } 129 }
133 err := a.playQueue.Play() 130 err := a.playQueue.Play()