From f48f7df9e3d16b6cabb2e1c639df8fc16924519b Mon Sep 17 00:00:00 2001 From: a Date: Sun, 15 Dec 2024 21:57:19 -0600 Subject: [PATCH] noot --- src/components/commands/devices.go | 6 ++++++ src/components/commands/play.go | 23 ++++++++--------------- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/src/components/commands/devices.go b/src/components/commands/devices.go index b045b47..a08caad 100644 --- a/src/components/commands/devices.go +++ b/src/components/commands/devices.go @@ -3,6 +3,7 @@ package commands import ( "encoding/json" "fmt" + "log" "os" "path/filepath" @@ -14,6 +15,11 @@ func (c *Commander) ListDevices() error { if err != nil { return err } + playerState, err := c.Client().PlayerState(c.Context) + if err != nil { + return err + } + log.Printf("%+v\n", playerState) return PrintDevices(devices) } diff --git a/src/components/commands/play.go b/src/components/commands/play.go index 4d68cb8..ff5a28d 100644 --- a/src/components/commands/play.go +++ b/src/components/commands/play.go @@ -9,22 +9,15 @@ import ( ) func (c *Commander) Play() error { - err := c.Client().Play(c.Context) + deviceID, err := c.activateDevice() if err != nil { - if isNoActiveError(err) { - deviceID, err := c.activateDevice() - if err != nil { - return err - } - err = c.Client().PlayOpt(c.Context, &spotify.PlayOptions{ - DeviceID: &deviceID, - }) - if err != nil { - return err - } - } else { - return err - } + return err + } + err = c.Client().PlayOpt(c.Context, &spotify.PlayOptions{ + DeviceID: &deviceID, + }) + if err != nil { + return fmt.Errorf("play opt: %w", err) } return nil }