now playing
This commit is contained in:
parent
8325459513
commit
b81ce0e878
@ -391,7 +391,7 @@ func (m *mainModel) Tick() {
|
|||||||
select {
|
select {
|
||||||
case <-ticker.C:
|
case <-ticker.C:
|
||||||
playing, _ := m.client.PlayerCurrentlyPlaying(m.ctx)
|
playing, _ := m.client.PlayerCurrentlyPlaying(m.ctx)
|
||||||
if playing.Playing {
|
if playing != nil && playing.Playing {
|
||||||
currentlyPlaying = "Now playing " + playing.Item.Name + " by " + playing.Item.Artists[0].Name
|
currentlyPlaying = "Now playing " + playing.Item.Name + " by " + playing.Item.Artists[0].Name
|
||||||
}
|
}
|
||||||
case <-quit:
|
case <-quit:
|
||||||
@ -537,13 +537,16 @@ func (m mainModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func InitMain(ctx *gctx.Context, client *spotify.Client, mode Mode) (tea.Model, error) {
|
func InitMain(ctx *gctx.Context, client *spotify.Client, mode Mode) (tea.Model, error) {
|
||||||
|
var err error
|
||||||
lipgloss.SetColorProfile(2)
|
lipgloss.SetColorProfile(2)
|
||||||
playing, _ := client.PlayerCurrentlyPlaying(ctx)
|
playing, err := client.PlayerCurrentlyPlaying(ctx)
|
||||||
if playing.Playing {
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if playing != nil && playing.Playing {
|
||||||
currentlyPlaying = "Now playing " + playing.Item.Name + " by " + playing.Item.Artists[0].Name
|
currentlyPlaying = "Now playing " + playing.Item.Name + " by " + playing.Item.Artists[0].Name
|
||||||
}
|
}
|
||||||
items := []list.Item{}
|
items := []list.Item{}
|
||||||
var err error
|
|
||||||
switch mode {
|
switch mode {
|
||||||
case Main:
|
case Main:
|
||||||
items, err = MainView(ctx, client)
|
items, err = MainView(ctx, client)
|
||||||
|
Loading…
Reference in New Issue
Block a user