24 lines
465 B
Go
24 lines
465 B
Go
|
package commands
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
)
|
||
|
|
||
|
func (c *Commander) Repeat() error {
|
||
|
state, err := c.Client.PlayerState(c.Context)
|
||
|
if err != nil {
|
||
|
return err
|
||
|
}
|
||
|
newState := "off"
|
||
|
if state.RepeatState == "off" {
|
||
|
newState = "context"
|
||
|
}
|
||
|
// spotifyd only supports binary value for repeat, context or off, change when/if spotifyd is better
|
||
|
err = c.Client.Repeat(c.Context, newState)
|
||
|
if err != nil {
|
||
|
return err
|
||
|
}
|
||
|
fmt.Println("Repeat set to", newState)
|
||
|
return nil
|
||
|
}
|