mirror of
https://github.com/aditya-K2/gspt.git
synced 2026-01-09 22:08:04 -05:00
Queue songs in playlist view
This commit is contained in:
@@ -61,6 +61,7 @@ var (
|
|||||||
"playlist_view": {
|
"playlist_view": {
|
||||||
"normal": {
|
"normal": {
|
||||||
{R: 'a'}: "add_to_playlist",
|
{R: 'a'}: "add_to_playlist",
|
||||||
|
{R: 'q'}: "queue_entry",
|
||||||
},
|
},
|
||||||
"visual": {
|
"visual": {
|
||||||
{R: 'a'}: "add_to_playlist",
|
{R: 'a'}: "add_to_playlist",
|
||||||
|
|||||||
@@ -297,6 +297,10 @@ func NewApplication() *tview.Application {
|
|||||||
playlistView.AddToPlaylist()
|
playlistView.AddToPlaylist()
|
||||||
return nil
|
return nil
|
||||||
}, nil),
|
}, nil),
|
||||||
|
"queue_entry": NewAction(func(e *tcell.EventKey) *tcell.EventKey {
|
||||||
|
playlistView.QueueEntry()
|
||||||
|
return nil
|
||||||
|
}, nil),
|
||||||
}))
|
}))
|
||||||
recentlyPlayedView.SetActions(utils.MergeMaps(globalActions, map[string]*Action{
|
recentlyPlayedView.SetActions(utils.MergeMaps(globalActions, map[string]*Action{
|
||||||
"add_to_playlist": NewAction(func(e *tcell.EventKey) *tcell.EventKey {
|
"add_to_playlist": NewAction(func(e *tcell.EventKey) *tcell.EventKey {
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package ui
|
package ui
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
"github.com/aditya-K2/gspt/spt"
|
"github.com/aditya-K2/gspt/spt"
|
||||||
"github.com/gdamore/tcell/v2"
|
"github.com/gdamore/tcell/v2"
|
||||||
"github.com/zmb3/spotify/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" }
|
func (p *PlaylistView) Name() string { return "PlaylistView" }
|
||||||
|
|||||||
Reference in New Issue
Block a user