spclient

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2026 License: GPL-3.0 Imports: 30 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewNarrationRequest added in v0.9.0

func NewNarrationRequest(ssml string, voice narrationpb.ResolveRequest_TtsVoice,
	provider narrationpb.ResolveRequest_TtsProvider, sampleRate int32) *narrationpb.TtsRequest

Types

type ContextResolver

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

func NewContextResolver

func NewContextResolver(ctx context.Context, log librespot.Logger, sp *Spclient, spotCtx *connectpb.Context) (_ *ContextResolver, err error)

func (*ContextResolver) Metadata

func (r *ContextResolver) Metadata() map[string]string

func (*ContextResolver) Page

func (r *ContextResolver) Page(ctx context.Context, idx int) ([]*connectpb.ContextTrack, error)

func (*ContextResolver) Restrictions

func (r *ContextResolver) Restrictions() *connectpb.Restrictions

func (*ContextResolver) Type

func (*ContextResolver) Uri

func (r *ContextResolver) Uri() string

type RateLimitedError added in v0.8.0

type RateLimitedError struct {
	RetryAfter time.Duration
	// contains filtered or unexported fields
}

RateLimitedError reports a connect-state 429; RetryAfter is the advised cooldown.

func (*RateLimitedError) Error added in v0.8.0

func (e *RateLimitedError) Error() string

func (*RateLimitedError) Unwrap added in v0.8.0

func (e *RateLimitedError) Unwrap() error

type Spclient

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

func NewSpclient

func NewSpclient(ctx context.Context, log librespot.Logger, client *http.Client, addr librespot.GetAddressFunc, accessToken librespot.GetLogin5TokenFunc, deviceId, clientToken string) (*Spclient, error)

func (*Spclient) ContextResolve

func (c *Spclient) ContextResolve(ctx context.Context, uri string) (*connectpb.Context, error)

func (*Spclient) ContextResolveAutoplay

func (c *Spclient) ContextResolveAutoplay(ctx context.Context, reqProto *playerpb.AutoplayContextRequest) (*connectpb.Context, error)

func (*Spclient) ContextResolveUrl added in v0.9.0

func (c *Spclient) ContextResolveUrl(ctx context.Context, hmUrl string) (*connectpb.Context, error)

ContextResolveUrl resolves a context through the hm:// url the Context carries rather than through /context-resolve/v1.

func (*Spclient) CreateResumePointRevision added in v0.8.0

func (*Spclient) ExtendedMetadata added in v0.3.3

func (*Spclient) ExtendedMetadataSimple added in v0.3.3

func (c *Spclient) ExtendedMetadataSimple(ctx context.Context, id librespot.SpotifyId, ext extmetadatapb.ExtensionKind, data proto.Message) error

func (*Spclient) GetAccessToken

func (c *Spclient) GetAccessToken(ctx context.Context, force bool) (string, error)

func (*Spclient) ListCurrentStates added in v0.8.0

func (*Spclient) NarrationUrl added in v0.9.0

func (c *Spclient) NarrationUrl(ctx context.Context, req *narrationpb.TtsRequest) (string, error)

NarrationUrl turns a narration script into the url of its synthesized audio.

func (*Spclient) NetFortune added in v0.3.0

func (c *Spclient) NetFortune(ctx context.Context, bandwidth int) (*netfortunepb.NetFortuneV2Response, error)

func (*Spclient) PlayPlayRequest added in v0.5.1

func (c *Spclient) PlayPlayRequest(ctx context.Context, fileId []byte, reqProto *streamingpb.PlayPlayLicenseRequest) (*streamingpb.PlayPlayLicenseResponse, error)

func (*Spclient) PlaylistSignals

func (c *Spclient) PlaylistSignals(ctx context.Context, playlist librespot.SpotifyId, reqProto *playlist4pb.ListSignals, lenses []string) (*playlist4pb.SelectedListContent, error)

func (*Spclient) PublishEvents added in v0.3.0

func (*Spclient) PutConnectState

func (c *Spclient) PutConnectState(ctx context.Context, spotConnId string, reqProto *connectpb.PutStateRequest) (*connectpb.Cluster, error)

func (*Spclient) PutConnectStateInactive

func (c *Spclient) PutConnectStateInactive(ctx context.Context, spotConnId string, notify bool) error

func (*Spclient) Request added in v0.1.3

func (c *Spclient) Request(ctx context.Context, method string, path string, query url.Values, header http.Header, body []byte) (*http.Response, error)

func (*Spclient) RequestHm added in v0.9.0

func (c *Spclient) RequestHm(ctx context.Context, method string, hmUrl string, header http.Header, body []byte) (*http.Response, error)

RequestHm issues a request against an hm:// URL, the form Spotify uses to name spclient endpoints inside payloads.

The remainder cannot simply be handed to Request as a path: JoinPath escapes the "?" of a query string. The query is kept verbatim rather than being parsed and re-encoded, so that a contextUri keeps its unescaped colons.

func (*Spclient) RequestNoRedirect added in v0.9.0

func (c *Spclient) RequestNoRedirect(ctx context.Context, method string, path string, query url.Values, header http.Header, body []byte) (*http.Response, error)

RequestNoRedirect is Request but returns the redirect itself rather than following it, for endpoints that answer with a Location instead of a body.

func (*Spclient) ResolveStorageInteractive

func (c *Spclient) ResolveStorageInteractive(ctx context.Context, fileId []byte, format *metadatapb.AudioFile_Format, prefetch bool) (*storagepb.StorageResolveResponse, error)

func (*Spclient) ResumePositionMs added in v0.8.0

func (c *Spclient) ResumePositionMs(ctx context.Context, id librespot.SpotifyId) (int64, error)

ResumePositionMs returns where playback of the given entity should start, in milliseconds. Zero means "from the beginning": either the backend has never seen the entity, or it was listened to the end and the next play is meant to restart it.

Only episodes and audiobook chapters have resume points; callers should not bother asking for tracks.

func (*Spclient) SetResumeFinished added in v0.8.0

func (c *Spclient) SetResumeFinished(ctx context.Context, id librespot.SpotifyId) error

SetResumeFinished marks the given entity as listened to the end, so the next play starts it over rather than resuming a position near the end.

func (*Spclient) SetResumePositionMs added in v0.8.0

func (c *Spclient) SetResumePositionMs(ctx context.Context, id librespot.SpotifyId, positionMs int64) error

SetResumePositionMs stores how far into the given entity playback has got.

func (*Spclient) WebApiRequest

func (c *Spclient) WebApiRequest(ctx context.Context, method string, path string, query url.Values, header http.Header, body []byte) (*http.Response, error)

Jump to

Keyboard shortcuts

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