diff options
Diffstat (limited to 'src/keybinds.go')
-rw-r--r-- | src/keybinds.go | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/keybinds.go b/src/keybinds.go index 74f7953..e3b80a1 100644 --- a/src/keybinds.go +++ b/src/keybinds.go | |||
@@ -51,6 +51,16 @@ func (a *app) setupMusicControlKeys(p *tview.Box) { | |||
51 | a.playQueueList.SetCurrentItem(sel - 1) | 51 | a.playQueueList.SetCurrentItem(sel - 1) |
52 | 52 | ||
53 | return nil | 53 | return nil |
54 | } else if event.Rune() == 'r' { | ||
55 | a.playQueue.Stop() | ||
56 | songs := a.playQueue.GetSongs() | ||
57 | a.playQueue.Clear() | ||
58 | for _, s := range randomize(songs) { | ||
59 | a.playQueue.Append(s) | ||
60 | } | ||
61 | |||
62 | a.playQueue.Play() | ||
63 | a.updatePageQueue() | ||
54 | } | 64 | } |
55 | } | 65 | } |
56 | 66 | ||
@@ -147,6 +157,21 @@ func (a *app) setupMusicControlKeys(p *tview.Box) { | |||
147 | } | 157 | } |
148 | 158 | ||
149 | a.updatePageQueue() | 159 | a.updatePageQueue() |
160 | } else if event.Rune() == 'r' { | ||
161 | sel := a.playlistsList.GetCurrentItem() | ||
162 | pl, err := a.sub.GetPlaylist(a.allPlaylists[sel].ID) | ||
163 | if err != nil { | ||
164 | a.alert("Error: %v", err) | ||
165 | return nil | ||
166 | } | ||
167 | |||
168 | a.playQueue.Clear() | ||
169 | for _, s := range randomize(pl.Entry) { | ||
170 | a.playQueue.Append(s) | ||
171 | } | ||
172 | a.playQueue.Play() | ||
173 | |||
174 | a.updatePageQueue() | ||
150 | } | 175 | } |
151 | } | 176 | } |
152 | 177 | ||