sonos

package
v0.0.0-...-a5f1b2c Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateAlbumMetadata

func CreateAlbumMetadata(deezerId uint64) ([]byte, error)

func CreatePlaylistMetadata

func CreatePlaylistMetadata(deezerId uint64) ([]byte, error)

func CreateTrackMetadata

func CreateTrackMetadata(deezerId string) ([]byte, error)

Types

type CardInfo

type CardInfo struct {
	// The ID of the card itself
	ID string `json:"id"`
	// AlbumID contains the Deezer album ID if applicable
	AlbumID *uint64 `json:"albumId,omitempty"`
	// PlaylistID contains the Deezer playlist ID if applicable
	PlaylistID *uint64 `json:"playlistId,omitempty"`
	// State is the last seen state of the card. If none exists, the state will be nil.
	State *CardStatus `json:"state,omitempty"`
	// Title is the human readable title of the album/playlist on the card. Helps in debugging.
	Title string `json:"title,omitempty"`
}

func FromAlbum

func FromAlbum(album *deezer.Album, cardId string) *CardInfo

func FromPlaylist

func FromPlaylist(p *deezer.Playlist, cardId string) *CardInfo

func (CardInfo) AlbumIDString

func (p CardInfo) AlbumIDString() string

func (CardInfo) PlaylistIDString

func (p CardInfo) PlaylistIDString() string

func (CardInfo) String

func (p CardInfo) String() string

func (CardInfo) ToPlayable

func (p CardInfo) ToPlayable() (deezer.Playable, error)

type CardStatus

type CardStatus struct {
	// CurrentTrack is the index of the track in the tracks array of the card.
	CurrentTrack int `json:"current_track"`
	// CurrentPosition is the position in the current track.
	CurrentPosition string `json:"current_position"`
}

type SonosSpeaker

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

func New

func New(name string) (*SonosSpeaker, error)

func (*SonosSpeaker) Clear

func (s *SonosSpeaker) Clear()

func (*SonosSpeaker) MediaInfo

func (s *SonosSpeaker) MediaInfo() (State, error)

func (*SonosSpeaker) Name

func (s *SonosSpeaker) Name() string

func (*SonosSpeaker) Next

func (s *SonosSpeaker) Next()

func (*SonosSpeaker) Pause

func (s *SonosSpeaker) Pause()

func (*SonosSpeaker) Play

func (s *SonosSpeaker) Play()

func (*SonosSpeaker) Previous

func (s *SonosSpeaker) Previous()

func (*SonosSpeaker) Seek

func (s *SonosSpeaker) Seek(position int)

func (*SonosSpeaker) SetPlaylist

func (s *SonosSpeaker) SetPlaylist(playlist CardInfo)

SetPlaylist clears the queue and then adds the given playlist for the speaker. Will use the order: * Album * Playlist * Tracks and use the first one that has been set. Repeat will also be set.

func (*SonosSpeaker) SetRepeat

func (s *SonosSpeaker) SetRepeat(repeat bool)

type State

type State struct {
	Track         string
	TrackDuration string
	RelTime       string
}

type TrackLocation

type TrackLocation int

type TrackType

type TrackType int

Jump to

Keyboard shortcuts

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