Documentation ¶
Overview ¶
Package spotcontol contains functions to remotely control spotify connect devices.
Index ¶
- Constants
- func ConvertTo62(raw []byte) string
- type Album
- type Artist
- type ArtistInsightsResponse
- type ArtistMetadataResponse
- type BlobInfo
- type CityListeners
- type ConnectDevice
- type Image
- type OAuth
- type PlayCountTrack
- type SearchResult
- type SpircController
- func Login(username string, password string, deviceName string) (*SpircController, error)
- func LoginBlob(username string, blob string, deviceName string) (*SpircController, error)
- func LoginBlobFile(cacheBlobPath, deviceName string) (*SpircController, error)
- func LoginDiscovery(cacheBlobPath, deviceName string) (*SpircController, error)
- func LoginOauth(deviceName string) (*SpircController, error)
- func LoginOauthToken(accessToken string, deviceName string) (*SpircController, error)
- func LoginSaved(username string, authData []byte, deviceName string) (*SpircController, error)
- func (c *SpircController) ConnectToDevice(address string)
- func (c *SpircController) GetArtistInsights(artistId string) (*ArtistInsightsResponse, error)
- func (c *SpircController) GetArtistMeta(artistId string) (*ArtistMetadataResponse, error)
- func (c *SpircController) GetPlaylist(id string) (*Spotify.SelectedListContent, error)
- func (c *SpircController) GetRootPlaylist() (*Spotify.SelectedListContent, error)
- func (c *SpircController) GetTrack(id string) (*Spotify.Track, error)
- func (c *SpircController) ListDevices() []ConnectDevice
- func (c *SpircController) ListMdnsDevices() ([]ConnectDevice, error)
- func (c *SpircController) LoadTrack(ident string, gids []string) error
- func (c *SpircController) LoadTrackIds(ident string, ids string) error
- func (c *SpircController) Search(search string) (*SearchResult, error)
- func (c *SpircController) SendHello() error
- func (c *SpircController) SendPause(ident string) error
- func (c *SpircController) SendPlay(ident string) error
- func (c *SpircController) SendVolume(ident string, volume int) error
- func (c *SpircController) Suggest(search string) (*SuggestResult, error)
- type SuggestResult
- type TopHit
- type Track
Constants ¶
const FOLD int = 16
const KEYP int = 13
const N int = 16
Variables ¶
This section is empty.
Functions ¶
func ConvertTo62 ¶
Types ¶
type ArtistInsightsResponse ¶
type ArtistInsightsResponse struct { Name string `json:"name"` DisplayURL string `json:"mainImageUrl"` GlobalChartPosition int64 `json:"globalChartPosition"` MonthlyListenerCount int64 `json:"monthlyListeners"` FollowerCount int64 `json:"followerCount"` FollowingCount int64 `json:"followingCount"` CityListenerCounts []CityListeners `json:"cities"` }
type ArtistMetadataResponse ¶
type ArtistMetadataResponse struct { ArtistInfo struct { Uri string `json:"uri"` Name string `json:"name"` Portraits []Image `json:"portraits"` } `json:"info"` TopTracks struct { Tracks []PlayCountTrack `json:"tracks"` } `json:"top_tracks"` CreatorAbout struct { MonthlyListeners int64 `json:"monthlyListeners"` GlobalChartPosition int64 `json:"globalChartPosition"` } `json:"creator_about"` }
type BlobInfo ¶
func BlobFromDiscovery ¶
Advertise spotify service via mdns. Waits for user to connect to 'spotcontrol' device. Extracts login data and returns login BlobInfo.
type CityListeners ¶
type ConnectDevice ¶
Represents an available spotify connect device. For mdns devices not yet authenitcated, Ident will be "" and Url will be the address to pass to ConnectToDevie.
type OAuth ¶
type PlayCountTrack ¶
type SearchResult ¶
type SearchResult struct { Artists struct { Hits []Artist `json:"hits"` Total int `json:"total"` } `json:"artists"` Albums struct { Hits []Album `json:"hits"` Total int `json:"total"` } `json:"albums"` Tracks struct { Hits []Track `json:"hits"` Total int `json:"total"` } `json:"tracks"` Error error }
type SpircController ¶
type SpircController struct { SavedCredentials []byte // contains filtered or unexported fields }
func Login ¶
func Login(username string, password string, deviceName string) (*SpircController, error)
Login to spotify using username, password
func LoginBlob ¶
func LoginBlob(username string, blob string, deviceName string) (*SpircController, error)
func LoginBlobFile ¶
func LoginBlobFile(cacheBlobPath, deviceName string) (*SpircController, error)
Login from credentials at cacheBlobPath previously saved by LoginDiscovery.
func LoginDiscovery ¶
func LoginDiscovery(cacheBlobPath, deviceName string) (*SpircController, error)
Registers spotcontrol as a spotify conenct device via mdns. When user connects, logs on to spotify and saves credentials in file at cacheBlobPath. Once saved, the blob credentials allow the program to connect to other spotify connect devices and control them.
func LoginOauth ¶
func LoginOauth(deviceName string) (*SpircController, error)
func LoginOauthToken ¶
func LoginOauthToken(accessToken string, deviceName string) (*SpircController, error)
func LoginSaved ¶
func LoginSaved(username string, authData []byte, deviceName string) (*SpircController, error)
func (*SpircController) ConnectToDevice ¶
func (c *SpircController) ConnectToDevice(address string)
Connect to spotify-connect device at address (local network path). Uses credentials from saved blob to authenticate.
func (*SpircController) GetArtistInsights ¶
func (c *SpircController) GetArtistInsights(artistId string) (*ArtistInsightsResponse, error)
func (*SpircController) GetArtistMeta ¶
func (c *SpircController) GetArtistMeta(artistId string) (*ArtistMetadataResponse, error)
func (*SpircController) GetPlaylist ¶
func (c *SpircController) GetPlaylist(id string) (*Spotify.SelectedListContent, error)
func (*SpircController) GetRootPlaylist ¶
func (c *SpircController) GetRootPlaylist() (*Spotify.SelectedListContent, error)
func (*SpircController) GetTrack ¶
func (c *SpircController) GetTrack(id string) (*Spotify.Track, error)
func (*SpircController) ListDevices ¶
func (c *SpircController) ListDevices() []ConnectDevice
List active spotify-connect devices that can be sent commands
func (*SpircController) ListMdnsDevices ¶
func (c *SpircController) ListMdnsDevices() ([]ConnectDevice, error)
Lists devices on local network advertising spotify connect service (_spotify-connect._tcp.).
func (*SpircController) LoadTrack ¶
func (c *SpircController) LoadTrack(ident string, gids []string) error
Load given list of tracks on spotify connect device with given ident. Gids are formated base62 spotify ids.
func (*SpircController) LoadTrackIds ¶
func (c *SpircController) LoadTrackIds(ident string, ids string) error
Load comma seperated tracks
func (*SpircController) Search ¶
func (c *SpircController) Search(search string) (*SearchResult, error)
func (*SpircController) SendHello ¶
func (c *SpircController) SendHello() error
Sends a 'hello' command to all spotify connect devices. Active devices will respond with a 'notify' updating their state.
func (*SpircController) SendPause ¶
func (c *SpircController) SendPause(ident string) error
Sends a 'pause' command to spotify connect device with given ident.
func (*SpircController) SendPlay ¶
func (c *SpircController) SendPlay(ident string) error
Sends a 'play' command to spotify connect device with given ident.
func (*SpircController) SendVolume ¶
func (c *SpircController) SendVolume(ident string, volume int) error
func (*SpircController) Suggest ¶
func (c *SpircController) Suggest(search string) (*SuggestResult, error)
type SuggestResult ¶
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
examples
|
|
Package Spotify is a generated protocol buffer package.
|
Package Spotify is a generated protocol buffer package. |