mirror of
https://github.com/aditya-K2/gspt.git
synced 2026-01-07 21:13:50 -05:00
Queue songs in playlist view
This commit is contained in:
@@ -61,6 +61,7 @@ var (
|
||||
"playlist_view": {
|
||||
"normal": {
|
||||
{R: 'a'}: "add_to_playlist",
|
||||
{R: 'q'}: "queue_entry",
|
||||
},
|
||||
"visual": {
|
||||
{R: 'a'}: "add_to_playlist",
|
||||
|
||||
@@ -297,6 +297,10 @@ func NewApplication() *tview.Application {
|
||||
playlistView.AddToPlaylist()
|
||||
return nil
|
||||
}, nil),
|
||||
"queue_entry": NewAction(func(e *tcell.EventKey) *tcell.EventKey {
|
||||
playlistView.QueueEntry()
|
||||
return nil
|
||||
}, nil),
|
||||
}))
|
||||
recentlyPlayedView.SetActions(utils.MergeMaps(globalActions, map[string]*Action{
|
||||
"add_to_playlist": NewAction(func(e *tcell.EventKey) *tcell.EventKey {
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package ui
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/aditya-K2/gspt/spt"
|
||||
"github.com/gdamore/tcell/v2"
|
||||
"github.com/zmb3/spotify/v2"
|
||||
@@ -77,4 +79,14 @@ func (p *PlaylistView) OpenEntry() {
|
||||
}
|
||||
}
|
||||
|
||||
func (p *PlaylistView) QueueEntry() {
|
||||
r, _ := Main.GetSelection()
|
||||
track := (*(*p.currentUserFullPlaylist).Tracks)[r].Track
|
||||
msg := fmt.Sprintf("%s Queued Succesfully!", track.Name)
|
||||
if err := spt.QueueTracks(track.ID); err != nil {
|
||||
msg = err.Error()
|
||||
}
|
||||
SendNotification(msg)
|
||||
}
|
||||
|
||||
func (p *PlaylistView) Name() string { return "PlaylistView" }
|
||||
|
||||
Reference in New Issue
Block a user