mirror of
https://github.com/aditya-K2/gspt.git
synced 2026-01-07 21:13:50 -05:00
Implement QueueEntry for playlist_nav
This commit is contained in:
@@ -55,6 +55,7 @@ var (
|
||||
"playlist_nav": {
|
||||
"normal": {
|
||||
{K: tcell.KeyCtrlP}: "play_entry",
|
||||
{R: 'q'}: "queue_entry",
|
||||
},
|
||||
},
|
||||
"playlist_view": {
|
||||
|
||||
@@ -286,6 +286,7 @@ func NewApplication() *tview.Application {
|
||||
App.SetFocus(Main)
|
||||
return nil
|
||||
}, nil),
|
||||
"queue_entry": NewAction(playlistNav.QueueEntry, nil),
|
||||
}))
|
||||
navMenu.SetActions(utils.MergeMaps(globalActions, map[string]*Action{
|
||||
"open_entry": NewAction(navMenu.OpenEntry,
|
||||
|
||||
15
ui/nav.go
15
ui/nav.go
@@ -83,6 +83,21 @@ func (v *PlaylistNav) PlayEntry(e *tcell.EventKey) *tcell.EventKey {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (v *PlaylistNav) QueueEntry(e *tcell.EventKey) *tcell.EventKey {
|
||||
r, _ := v.Table.GetSelection()
|
||||
playlist := (*v.Playlists)[r]
|
||||
msg := SendNotificationWithChan("Queueing %s...", playlist.Name)
|
||||
go func() {
|
||||
if err := spt.QueuePlaylist(playlist.ID); err != nil {
|
||||
msg <- err.Error()
|
||||
return
|
||||
}
|
||||
msg <- playlist.Name + " Queued Succesfully!"
|
||||
}()
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (v *PlaylistNav) RefreshState() {
|
||||
p, ch := spt.CurrentUserPlaylists()
|
||||
go func() {
|
||||
|
||||
Reference in New Issue
Block a user