diff --git a/config/key.go b/config/key.go index 61b3de0..ad3c0d8 100644 --- a/config/key.go +++ b/config/key.go @@ -79,6 +79,7 @@ var ( "artists_view": { "normal": { {K: tcell.KeyEnter}: "open_entry", + {K: tcell.KeyCtrlP}: "play_entry", }, }, "artist_view": { diff --git a/ui/app.go b/ui/app.go index 33b35da..92c3843 100644 --- a/ui/app.go +++ b/ui/app.go @@ -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), })) diff --git a/ui/view_artists.go b/ui/view_artists.go index 51fa4c6..4eab640 100644 --- a/ui/view_artists.go +++ b/ui/view_artists.go @@ -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" }