mirror of
https://github.com/aditya-K2/gspt.git
synced 2026-01-09 22:08:04 -05:00
Implement QueueEntry for liked_songs_view
This commit is contained in:
@@ -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