mirror of
https://github.com/aditya-K2/gspt.git
synced 2026-01-07 21:13:50 -05:00
Implement QueueEntry for liked_songs_view
This commit is contained in:
@@ -74,6 +74,7 @@ var (
|
||||
"liked_songs_view": {
|
||||
"normal": {
|
||||
{R: 'a'}: "add_to_playlist",
|
||||
{R: 'q'}: "queue_entry",
|
||||
},
|
||||
"visual": {
|
||||
{R: 'a'}: "add_to_playlist",
|
||||
|
||||
@@ -322,6 +322,10 @@ func NewApplication() *tview.Application {
|
||||
likedSongsView.AddToPlaylist()
|
||||
return nil
|
||||
}, nil),
|
||||
"queue_entry": NewAction(func(e *tcell.EventKey) *tcell.EventKey {
|
||||
likedSongsView.QueueEntry()
|
||||
return nil
|
||||
}, nil),
|
||||
}))
|
||||
searchView.SetActions(utils.MergeMaps(globalActions, map[string]*Action{
|
||||
"play_entry": 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"
|
||||
@@ -66,6 +68,16 @@ func (l *LikedSongsView) OpenEntry() {
|
||||
}
|
||||
}
|
||||
|
||||
func (l *LikedSongsView) QueueEntry() {
|
||||
r, _ := Main.GetSelection()
|
||||
track := (*l.likedSongs)[r]
|
||||
msg := fmt.Sprintf("%s Queued Succesfully!", track.Name)
|
||||
if err := spt.QueueTracks(track.ID); err != nil {
|
||||
msg = err.Error()
|
||||
}
|
||||
SendNotification(msg)
|
||||
}
|
||||
|
||||
func (l *LikedSongsView) Name() string { return "LikedSongsView" }
|
||||
|
||||
func (p *LikedSongsView) refreshState(errHandler func(error)) {
|
||||
|
||||
Reference in New Issue
Block a user