diff options
Diffstat (limited to 'src/keybinds.go')
-rw-r--r-- | src/keybinds.go | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/src/keybinds.go b/src/keybinds.go index ffdf64a..74f7953 100644 --- a/src/keybinds.go +++ b/src/keybinds.go | |||
@@ -120,6 +120,50 @@ func (a *app) setupMusicControlKeys(p *tview.Box) { | |||
120 | } | 120 | } |
121 | } | 121 | } |
122 | 122 | ||
123 | if a.tv.GetFocus() == a.playlistsList { | ||
124 | if event.Rune() == 'e' { | ||
125 | sel := a.playlistsList.GetCurrentItem() | ||
126 | pl, err := a.sub.GetPlaylist(a.allPlaylists[sel].ID) | ||
127 | if err != nil { | ||
128 | a.alert("Error: %v", err) | ||
129 | return nil | ||
130 | } | ||
131 | |||
132 | for _, s := range pl.Entry { | ||
133 | a.playQueue.Append(s) | ||
134 | } | ||
135 | |||
136 | a.updatePageQueue() | ||
137 | } else if event.Rune() == 'n' { | ||
138 | sel := a.playlistsList.GetCurrentItem() | ||
139 | pl, err := a.sub.GetPlaylist(a.allPlaylists[sel].ID) | ||
140 | if err != nil { | ||
141 | a.alert("Error: %v", err) | ||
142 | return nil | ||
143 | } | ||
144 | |||
145 | for i := len(pl.Entry) - 1; i >= 0; i-- { | ||
146 | a.playQueue.Insert(1, pl.Entry[i]) | ||
147 | } | ||
148 | |||
149 | a.updatePageQueue() | ||
150 | } | ||
151 | } | ||
152 | |||
153 | if a.tv.GetFocus() == a.playlistSongs { | ||
154 | if event.Rune() == 'e' { | ||
155 | sel := a.playlistSongs.GetCurrentItem() | ||
156 | a.playQueue.Append(a.currentPlaylist.Entry[sel]) | ||
157 | |||
158 | a.updatePageQueue() | ||
159 | } else if event.Rune() == 'n' { | ||
160 | sel := a.playlistSongs.GetCurrentItem() | ||
161 | a.playQueue.Insert(1, a.currentPlaylist.Entry[sel]) | ||
162 | |||
163 | a.updatePageQueue() | ||
164 | } | ||
165 | } | ||
166 | |||
123 | return event | 167 | return event |
124 | }) | 168 | }) |
125 | } | 169 | } |