Implement play_entry for artists_view

This commit is contained in:
aditya-K2
2023-05-01 23:05:59 +05:30
parent 9217b55ece
commit 28c2eed747
3 changed files with 14 additions and 2 deletions

View File

@@ -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),
}))

View File

@@ -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" }