mirror of
https://github.com/aditya-K2/gspt.git
synced 2026-01-08 21:37:58 -05:00
Implement play_entry for artists_view
This commit is contained in:
@@ -278,7 +278,11 @@ func NewApplication() *tview.Application {
|
||||
}))
|
||||
artistsView.SetActions(utils.MergeMaps(globalActions, map[string]*Action{
|
||||
"open_entry": NewAction(func(e *tcell.EventKey) *tcell.EventKey {
|
||||
artistsView.OpenArtist()
|
||||
artistsView.OpenEntry()
|
||||
return nil
|
||||
}, nil),
|
||||
"play_entry": NewAction(func(e *tcell.EventKey) *tcell.EventKey {
|
||||
artistsView.PlayEntry()
|
||||
return nil
|
||||
}, nil),
|
||||
}))
|
||||
|
||||
@@ -45,10 +45,17 @@ func (a *ArtistsView) Content() func() [][]Content {
|
||||
}
|
||||
}
|
||||
|
||||
func (a *ArtistsView) OpenArtist() {
|
||||
func (a *ArtistsView) OpenEntry() {
|
||||
r, _ := Main.GetSelection()
|
||||
artistView.SetArtist(&(*a.followedArtists)[r].ID)
|
||||
SetCurrentView(artistView)
|
||||
}
|
||||
|
||||
func (a *ArtistsView) PlayEntry() {
|
||||
r, _ := Main.GetSelection()
|
||||
if err := spt.PlayContext(&(*a.followedArtists)[r].URI); err != nil {
|
||||
SendNotification(err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
func (a *ArtistsView) Name() string { return "ArtistsView" }
|
||||
|
||||
Reference in New Issue
Block a user