core

package
v0.0.0-...-f1acb3f Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2019 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BuildID = "dev"
View Source
var Version = "master"

Functions

This section is empty.

Types

type OAuth

type OAuth struct {
	AccessToken  string `json:"access_token"`
	RefreshToken string `json:"refresh_token"`
	Scope        string `json:"scope"`
	Error        string
}

func GetOauthAccessToken

func GetOauthAccessToken(code string, redirectUri string, clientId string, clientSecret string) (*OAuth, error)

type Session

type Session struct {

	/// State and variables
	// DeviceId is the device identifier (computer name, Android serial number, ...) sent during auth to the Spotify
	// servers for this session
	DeviceId string
	// DeviceName is the device name (Android device model) sent during auth to the Spotify servers for this session
	DeviceName string
	// Username is the currently authenticated canonical username
	Username string
	// ReusableAuthBlob is the reusable authentication blob for Spotify Connect devices
	ReusableAuthBlob []byte
	// Country is the user country returned by the Spotify servers
	Country string
	// contains filtered or unexported fields
}

Session represents an active Spotify connection

func Login

func Login(username string, password string, deviceName string) (*Session, error)

Login to Spotify using username and password

func LoginDiscovery

func LoginDiscovery(cacheBlobPath string, deviceName string) (*Session, error)

Registers librespot as a Spotify Connect 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 LoginDiscoveryBlob

func LoginDiscoveryBlob(username string, blob string, deviceName string) (*Session, error)

Login using an authentication blob through Spotify Connect discovery system, reading an existing blob data. To read from a file, see LoginDiscoveryBlobFile.

func LoginDiscoveryBlobFile

func LoginDiscoveryBlobFile(cacheBlobPath, deviceName string) (*Session, error)

Login from credentials at cacheBlobPath previously saved by LoginDiscovery. Similar to LoginDiscoveryBlob, except it reads it directly from a file.

func LoginOAuth

func LoginOAuth(deviceName string, clientId string, clientSecret string) (*Session, error)

Login to Spotify using the OAuth method

func LoginSaved

func LoginSaved(username string, authData []byte, deviceName string) (*Session, error)

Login to Spotify using an existing authData blob

func (*Session) Discovery

func (s *Session) Discovery() *discovery.Discovery

func (*Session) Mercury

func (s *Session) Mercury() *mercury.Client

func (*Session) Player

func (s *Session) Player() *player.Player

func (*Session) Stream

func (s *Session) Stream() connection.PacketStream

Jump to

Keyboard shortcuts

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