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 }