respot

package
v0.0.0-...-662d8f0 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var StartNewSession func(ctx *SessionContext) (Session, error)

Forward declared method to create a new Spotify session

Functions

func APResolve

func APResolve() (string, error)

APResolve fetches the available Spotify access point URLs and picks a random one

func GenerateDeviceUID

func GenerateDeviceUID(name string) string

Types

type APList

type APList struct {
	ApList []string `json:"ap_list"`
}

APList is the JSON structure corresponding to the output of the AP endpoint resolve API

type PinOpts

type PinOpts struct {

	// If set, MediaAsset.OnStart(Ctx().Context) will be called on the returned MediaAsset.
	// This is for convenience but not desirable when the asset is in a time-to-live cache, for example.
	StartInternally bool
}

type Session

type Session interface {
	Close() error

	// Returns the SessionContext current in use by this session
	Context() *SessionContext

	// Initiates login with params contained in Ctx.Login
	Login() error

	Search(query string, limit int) (*mercury.SearchResponse, error)
	Mercury() *mercury.Client

	// Initiates access ("pinning") with the given spotify track ID or URI
	PinTrack(trackID string, opts PinOpts) (amp.MediaAsset, error)
}

type SessionContext

type SessionContext struct {
	task.Context              // logging & shutdown
	Login        SessionLogin // means for the session to login
	Info         SessionInfo  // filled in during Session.Login()
	Keys         crypto.Keys  // If left nil, will be auto-generated
	DeviceName   string       // Label of the device being used
	DeviceUID    string       // if nil, auto-generated from DeviceName
}

func DefaultSessionContext

func DefaultSessionContext(deviceLabel string) *SessionContext

type SessionInfo

type SessionInfo struct {
	Username string // authenticated canonical username
	AuthBlob []byte // reusable authentication blob for Spotify Connect devices
	Country  string // user country returned by Spotify
}

type SessionLogin

type SessionLogin struct {
	Username  string
	Password  string // AUTHENTICATION_USER_PASS
	AuthData  []byte // AUTHENTICATION_STORED_SPOTIFY_CREDENTIALS
	AuthToken string // AUTHENTICATION_SPOTIFY_TOKEN
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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