mirror of
https://github.com/aditya-K2/gspt.git
synced 2026-01-09 13:58:05 -05:00
Implement QueueEntry for recently_played_view
This commit is contained in:
@@ -14,6 +14,7 @@ var (
|
|||||||
"recently_played_view": {
|
"recently_played_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",
|
||||||
|
|||||||
@@ -302,6 +302,10 @@ func NewApplication() *tview.Application {
|
|||||||
recentlyPlayedView.AddToPlaylist()
|
recentlyPlayedView.AddToPlaylist()
|
||||||
return nil
|
return nil
|
||||||
}, nil),
|
}, nil),
|
||||||
|
"queue_entry": NewAction(func(e *tcell.EventKey) *tcell.EventKey {
|
||||||
|
recentlyPlayedView.QueueEntry()
|
||||||
|
return nil
|
||||||
|
}, nil),
|
||||||
}))
|
}))
|
||||||
topTracksView.SetActions(utils.MergeMaps(globalActions, map[string]*Action{
|
topTracksView.SetActions(utils.MergeMaps(globalActions, map[string]*Action{
|
||||||
"play_entry": NewAction(func(e *tcell.EventKey) *tcell.EventKey {
|
"play_entry": 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/aditya-K2/utils"
|
"github.com/aditya-K2/utils"
|
||||||
"github.com/gdamore/tcell/v2"
|
"github.com/gdamore/tcell/v2"
|
||||||
@@ -73,3 +75,13 @@ func (re *RecentlyPlayedView) OpenEntry() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (re *RecentlyPlayedView) QueueEntry() {
|
||||||
|
r, _ := Main.GetSelection()
|
||||||
|
track := re.recentlyPlayed[r].Track
|
||||||
|
msg := fmt.Sprintf("%s Queued Succesfully!", track.Name)
|
||||||
|
if err := spt.QueueTracks(track.ID); err != nil {
|
||||||
|
msg = err.Error()
|
||||||
|
}
|
||||||
|
SendNotification(msg)
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user