sonos

package module
v0.0.0-...-3612c1e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 16, 2024 License: MIT Imports: 10 Imported by: 0

README

This is a Go package for controlling a Sonos system.

https://svrooij.io/sonos-api-docs/ was a good reference.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func Discover

func Discover(ctx context.Context) (*Client, error)

func (*Client) NumDevices

func (c *Client) NumDevices() int

func (*Client) NumZones

func (c *Client) NumZones() int

func (*Client) ZoneDevice

func (c *Client) ZoneDevice(ctx context.Context, zone string) (*Device, error)

type Device

type Device struct {
	// contains filtered or unexported fields
}

func (*Device) ClearQueue

func (d *Device) ClearQueue(ctx context.Context) error

func (*Device) Join

func (d *Device) Join(ctx context.Context, master *Device) error

Join adds the device to a group coordinated by the identified master device.

func (*Device) LoadSonosPlaylist

func (d *Device) LoadSonosPlaylist(ctx context.Context, playlistName string) error

func (*Device) Play

func (d *Device) Play(ctx context.Context) error

func (*Device) RampVolume

func (d *Device) RampVolume(ctx context.Context, volume int) (time.Duration, error)

RampVolume smoothly adjusts the device's volume to the target. It returns how long the ramp is expected to take.

func (*Device) SetPlayMode

func (d *Device) SetPlayMode(ctx context.Context, mode PlayMode) error

func (*Device) SetSleepTimer

func (d *Device) SetSleepTimer(ctx context.Context, duration time.Duration) error

func (*Device) SetVolume

func (d *Device) SetVolume(ctx context.Context, volume int) error

SetVolume sets the devices volume, in range [0,100].

func (*Device) Stop

func (d *Device) Stop(ctx context.Context) error

func (*Device) Ungroup

func (d *Device) Ungroup(ctx context.Context) error

type PlayMode

type PlayMode int
const (
	NormalPlayMode PlayMode = iota
	RepeatAll
	RepeatOne
	Shuffle
	ShuffleRepeat
	ShuffleRepeatOne
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL