Documentation
¶
Overview ¶
Package daemon provides primitives to interact with the openapi HTTP API.
Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.5.0 DO NOT EDIT.
Index ¶
- Variables
- func Handler(si ServerInterface) http.Handler
- func HandlerFromMux(si ServerInterface, m ServeMux) http.Handler
- func HandlerFromMuxWithBaseURL(si ServerInterface, m ServeMux, baseURL string) http.Handler
- func HandlerWithOptions(si ServerInterface, options StdHTTPServerOptions) http.Handler
- type ApiAddToQueue
- type ApiContextTrackItem
- type ApiContextTracks
- type ApiDeviceAuth
- type ApiEvent
- type ApiEventDataMetadata
- type ApiEventDataNotPlaying
- type ApiEventDataPaused
- type ApiEventDataPlaybackError
- type ApiEventDataPlaying
- type ApiEventDataRepeatContext
- type ApiEventDataRepeatTrack
- type ApiEventDataSeek
- type ApiEventDataShuffleContext
- type ApiEventDataStopped
- type ApiEventDataVolume
- type ApiEventDataWillPlay
- type ApiEventType
- type ApiNext
- type ApiOutput
- type ApiPlay
- type ApiRepeatContext
- type ApiRepeatTrack
- type ApiRequest
- type ApiRequestDataContextTracks
- type ApiRequestType
- type ApiRoot
- type ApiSeek
- type ApiServer
- type ApiSetDeviceName
- type ApiSetVolume
- type ApiShuffleContext
- type ApiStatus
- type ApiToken
- type ApiTrack
- type ApiVolume
- type App
- type AppPlayer
- type CacheConfig
- type ConcreteApiServer
- func (s *ConcreteApiServer) Close() error
- func (s *ConcreteApiServer) Emit(ev *ApiEvent)
- func (s *ConcreteApiServer) GetAuthCode(w http.ResponseWriter, _ *http.Request)
- func (s *ConcreteApiServer) GetContextTracks(w http.ResponseWriter, _ *http.Request, params GetContextTracksParams)
- func (s *ConcreteApiServer) GetEvents(w http.ResponseWriter, r *http.Request)
- func (s *ConcreteApiServer) GetRoot(w http.ResponseWriter, _ *http.Request)
- func (s *ConcreteApiServer) GetStatus(w http.ResponseWriter, _ *http.Request)
- func (s *ConcreteApiServer) GetToken(w http.ResponseWriter, _ *http.Request)
- func (s *ConcreteApiServer) PlayerAddToQueue(w http.ResponseWriter, r *http.Request)
- func (s *ConcreteApiServer) PlayerGetVolume(w http.ResponseWriter, _ *http.Request)
- func (s *ConcreteApiServer) PlayerNext(w http.ResponseWriter, r *http.Request)
- func (s *ConcreteApiServer) PlayerOutput(w http.ResponseWriter, r *http.Request)
- func (s *ConcreteApiServer) PlayerPause(w http.ResponseWriter, _ *http.Request)
- func (s *ConcreteApiServer) PlayerPlay(w http.ResponseWriter, r *http.Request)
- func (s *ConcreteApiServer) PlayerPlayPause(w http.ResponseWriter, _ *http.Request)
- func (s *ConcreteApiServer) PlayerPrev(w http.ResponseWriter, _ *http.Request)
- func (s *ConcreteApiServer) PlayerRepeatContext(w http.ResponseWriter, r *http.Request)
- func (s *ConcreteApiServer) PlayerRepeatTrack(w http.ResponseWriter, r *http.Request)
- func (s *ConcreteApiServer) PlayerResume(w http.ResponseWriter, _ *http.Request)
- func (s *ConcreteApiServer) PlayerSeek(w http.ResponseWriter, r *http.Request)
- func (s *ConcreteApiServer) PlayerSetVolume(w http.ResponseWriter, r *http.Request)
- func (s *ConcreteApiServer) PlayerShuffleContext(w http.ResponseWriter, r *http.Request)
- func (s *ConcreteApiServer) PlayerStop(w http.ResponseWriter, _ *http.Request)
- func (s *ConcreteApiServer) Receive() <-chan ApiRequest
- func (s *ConcreteApiServer) SetAuthCode(auth *ApiDeviceAuth)
- func (s *ConcreteApiServer) SetDeviceName(w http.ResponseWriter, r *http.Request)
- type Config
- type CredentialsConfig
- type GetContextTracksParams
- type InteractiveCredentials
- type InvalidParamFormatError
- type MetadataConfig
- type MiddlewareFunc
- type Options
- type PlayerAddToQueueJSONRequestBody
- type PlayerNextJSONRequestBody
- type PlayerOutputJSONRequestBody
- type PlayerPlayJSONRequestBody
- type PlayerRepeatContextJSONRequestBody
- type PlayerRepeatTrackJSONRequestBody
- type PlayerSeekJSONRequestBody
- type PlayerSetVolumeJSONRequestBody
- type PlayerShuffleContextJSONRequestBody
- type ProductInfo
- type RequiredHeaderError
- type RequiredParamError
- type ServeMux
- type ServerInterface
- type ServerInterfaceWrapper
- func (siw *ServerInterfaceWrapper) GetAuthCode(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetContextTracks(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetEvents(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetRoot(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetStatus(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetToken(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) PlayerAddToQueue(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) PlayerGetVolume(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) PlayerNext(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) PlayerOutput(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) PlayerPause(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) PlayerPlay(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) PlayerPlayPause(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) PlayerPrev(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) PlayerRepeatContext(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) PlayerRepeatTrack(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) PlayerResume(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) PlayerSeek(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) PlayerSetVolume(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) PlayerShuffleContext(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) PlayerStop(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) SetDeviceName(w http.ResponseWriter, r *http.Request)
- type SetDeviceNameJSONRequestBody
- type SpotifyTokenCredentials
- type State
- type StdHTTPServerOptions
- type StubApiServer
- type TooManyValuesForParamError
- type TrackCodec
- type UnescapedCookieParamError
- type UnmarshalingParamError
- type ZeroconfCredentials
Constants ¶
This section is empty.
Variables ¶
var ( ErrNoSession = errors.New("no session") ErrBadRequest = errors.New("bad request") ErrForbidden = errors.New("forbidden") ErrNotFound = errors.New("not found") ErrMethodNotAllowed = errors.New("method not allowed") ErrTooManyRequests = errors.New("the app has exceeded its rate limits") )
var ( // ErrSuperseded reports that a newer command arrived before this one's // network work finished, so its result was thrown away. ErrSuperseded = errors.New("superseded by a newer command") // ErrLoaderBusy reports that the daemon has more work queued than it can // usefully hold. ErrLoaderBusy = errors.New("player is busy") )
var ErrNoContext = errors.New("no context")
ErrNoContext reports that a command needing a track list arrived when the daemon has no context loaded.
Functions ¶
func Handler ¶ added in v0.9.0
func Handler(si ServerInterface) http.Handler
Handler creates http.Handler with routing matching OpenAPI spec.
func HandlerFromMux ¶ added in v0.9.0
func HandlerFromMux(si ServerInterface, m ServeMux) http.Handler
HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux.
func HandlerFromMuxWithBaseURL ¶ added in v0.9.0
func HandlerFromMuxWithBaseURL(si ServerInterface, m ServeMux, baseURL string) http.Handler
func HandlerWithOptions ¶ added in v0.9.0
func HandlerWithOptions(si ServerInterface, options StdHTTPServerOptions) http.Handler
HandlerWithOptions creates http.Handler with additional options
Types ¶
type ApiAddToQueue ¶ added in v0.9.0
type ApiAddToQueue struct {
// Uri The URI for the track that should be added
Uri string `json:"uri"`
}
ApiAddToQueue An add to queue payload
type ApiContextTrackItem ¶ added in v0.10.0
type ApiContextTrackItem struct {
// Track Full track metadata, or null while the background sweep has not resolved this entry yet
Track *ApiTrack `json:"track"`
// Uri The track URI
Uri string `json:"uri"`
}
ApiContextTrackItem One entry of a context listing
type ApiContextTracks ¶ added in v0.10.0
type ApiContextTracks struct {
// Cached Entries with full metadata; poll again while cached < length
Cached int `json:"cached"`
// Length Number of track entries
Length int `json:"length"`
// Ready False while the context is still being enumerated in the background; the listing is empty until it is true
Ready bool `json:"ready"`
Tracks []ApiContextTrackItem `json:"tracks"`
// Uri The context URI
Uri string `json:"uri"`
}
ApiContextTracks A context's track listing
type ApiDeviceAuth ¶ added in v0.9.1
type ApiDeviceAuth struct {
// Code The code the user must enter at the URL, if prompted
Code string `json:"code"`
// ExpiresAt When the code stops being accepted
ExpiresAt time.Time `json:"expires_at"`
// Url The URL the user must visit to approve the request. It usually embeds the code already, in which case entering it is not needed.
Url string `json:"url"`
}
ApiDeviceAuth The pairing details of an in-flight device authorization flow
type ApiEvent ¶
type ApiEvent struct {
Type ApiEventType `json:"type"`
Data any `json:"data"`
}
type ApiEventDataMetadata ¶
type ApiEventDataMetadata ApiTrack
type ApiEventDataNotPlaying ¶
type ApiEventDataPaused ¶
type ApiEventDataPlaybackError ¶ added in v0.10.2
type ApiEventDataPlaying ¶
type ApiEventDataRepeatContext ¶
type ApiEventDataRepeatContext struct {
Value bool `json:"value"`
}
type ApiEventDataRepeatTrack ¶
type ApiEventDataRepeatTrack struct {
Value bool `json:"value"`
}
type ApiEventDataSeek ¶
type ApiEventDataShuffleContext ¶
type ApiEventDataShuffleContext struct {
Value bool `json:"value"`
}
type ApiEventDataStopped ¶
type ApiEventDataStopped struct {
PlayOrigin string `json:"play_origin"`
}
type ApiEventDataVolume ¶
type ApiEventDataVolume ApiVolume
type ApiEventDataWillPlay ¶
type ApiEventType ¶
type ApiEventType string
const ( ApiEventTypePlaying ApiEventType = "playing" ApiEventTypeNotPlaying ApiEventType = "not_playing" ApiEventTypeWillPlay ApiEventType = "will_play" ApiEventTypePaused ApiEventType = "paused" ApiEventTypeActive ApiEventType = "active" ApiEventTypeInactive ApiEventType = "inactive" ApiEventTypeMetadata ApiEventType = "metadata" ApiEventTypeVolume ApiEventType = "volume" ApiEventTypeSeek ApiEventType = "seek" ApiEventTypeStopped ApiEventType = "stopped" ApiEventTypeRepeatTrack ApiEventType = "repeat_track" ApiEventTypeRepeatContext ApiEventType = "repeat_context" ApiEventTypeShuffleContext ApiEventType = "shuffle_context" ApiEventTypePlaybackReady ApiEventType = "playback_ready" ApiEventTypePlaybackError ApiEventType = "playback_error" )
type ApiNext ¶ added in v0.9.0
type ApiNext struct {
// Uri The track URI to skip to. When omitted the next track in the context is played.
Uri *string `json:"uri,omitempty"`
}
ApiNext A skip to next payload
type ApiOutput ¶ added in v0.9.0
type ApiOutput struct {
// Device The output device name to open (backend-specific, e.g. an ALSA device). Empty selects the configured default.
Device string `json:"device,omitempty"`
}
ApiOutput A reopen audio output payload
type ApiPlay ¶ added in v0.9.0
type ApiPlay struct {
// Paused Start playback as paused
Paused bool `json:"paused,omitempty"`
// Position Position in milliseconds to start playback at within the selected track (0 starts from the beginning)
Position int64 `json:"position,omitempty"`
// SkipToUri Spotify URI to skip to (when playing playlists)
SkipToUri string `json:"skip_to_uri,omitempty"`
// Uri Spotify URI to start playing
Uri string `json:"uri"`
}
ApiPlay An initiate playback payload
type ApiRepeatContext ¶ added in v0.9.0
type ApiRepeatContext struct {
// RepeatContext Whether repeating context should be enabled
RepeatContext bool `json:"repeat_context"`
}
ApiRepeatContext A toggle repeating context payload
type ApiRepeatTrack ¶ added in v0.9.0
type ApiRepeatTrack struct {
// RepeatTrack Whether repeating track should be enabled
RepeatTrack bool `json:"repeat_track"`
}
ApiRepeatTrack A toggle repeating track payload
type ApiRequest ¶
type ApiRequest struct {
Type ApiRequestType
Data any
// contains filtered or unexported fields
}
func NewApiRequest ¶
func NewApiRequest(t ApiRequestType, data any) (req ApiRequest, wait func(context.Context) (any, error))
NewApiRequest builds an ApiRequest pre-wired with a reply channel, plus a wait function that blocks until the daemon calls Reply (or ctx is done).
func (*ApiRequest) Reply ¶
func (r *ApiRequest) Reply(data any, err error)
type ApiRequestDataContextTracks ¶ added in v0.10.0
type ApiRequestDataContextTracks struct {
Uri string
}
ApiRequestDataContextTracks carries the uri query parameter of the context listing request; the spec generates payloads only for request bodies.
type ApiRequestType ¶
type ApiRequestType string
const ( ApiRequestTypeRoot ApiRequestType = "root" ApiRequestTypeStatus ApiRequestType = "status" ApiRequestTypeResume ApiRequestType = "resume" ApiRequestTypePause ApiRequestType = "pause" ApiRequestTypePlayPause ApiRequestType = "playpause" ApiRequestTypeSeek ApiRequestType = "seek" ApiRequestTypePrev ApiRequestType = "prev" ApiRequestTypeNext ApiRequestType = "next" ApiRequestTypePlay ApiRequestType = "play" ApiRequestTypeStop ApiRequestType = "stop" ApiRequestTypeGetVolume ApiRequestType = "get_volume" ApiRequestTypeSetVolume ApiRequestType = "set_volume" ApiRequestTypeSetRepeatingContext ApiRequestType = "repeating_context" ApiRequestTypeSetRepeatingTrack ApiRequestType = "repeating_track" ApiRequestTypeSetShufflingContext ApiRequestType = "shuffling_context" ApiRequestTypeAddToQueue ApiRequestType = "add_to_queue" ApiRequestTypeToken ApiRequestType = "token" ApiRequestSetDeviceName ApiRequestType = "set_device_name" ApiRequestTypeReopenOutput ApiRequestType = "reopen_output" ApiRequestTypeContextTracks ApiRequestType = "context_tracks" )
type ApiRoot ¶ added in v0.9.0
type ApiRoot struct {
// PlaybackReady Whether the daemon is fully bootstrapped and ready to accept /player/play
PlaybackReady bool `json:"playback_ready"`
}
ApiRoot API reachability and playback readiness
type ApiSeek ¶ added in v0.9.0
type ApiSeek struct {
// Position Seek position in milliseconds. Must not be negative unless relative is set.
Position int64 `json:"position"`
// Relative Whether the seek position is relative to the current one
Relative bool `json:"relative,omitempty"`
}
ApiSeek A seek payload
type ApiServer ¶
type ApiServer interface {
Emit(ev *ApiEvent)
Receive() <-chan ApiRequest
SetAuthCode(auth *ApiDeviceAuth)
Close() error
}
func NewApiServer ¶
type ApiSetDeviceName ¶ added in v0.9.0
type ApiSetDeviceName struct {
// Name The new device name
Name string `json:"name"`
}
ApiSetDeviceName A set device name payload
type ApiSetVolume ¶ added in v0.9.0
type ApiSetVolume struct {
// Relative Whether to change the volume relative to the current volume
Relative bool `json:"relative,omitempty"`
// Volume Volume from 0 to max. Must not be negative unless relative is set.
Volume int32 `json:"volume"`
}
ApiSetVolume A set volume payload
type ApiShuffleContext ¶ added in v0.9.0
type ApiShuffleContext struct {
// ShuffleContext Whether shuffling context should be enabled
ShuffleContext bool `json:"shuffle_context"`
}
ApiShuffleContext A toggle shuffling context payload
type ApiStatus ¶ added in v0.9.0
type ApiStatus struct {
// Buffering Whether the player is buffering
Buffering bool `json:"buffering"`
// ContextName The display name of the context, for example the playlist or album name, null when there is no context or the resolver did not provide a description
ContextName *string `json:"context_name"`
// ContextUri The URI of the context playback is coming from, null when there is no context
ContextUri *string `json:"context_uri"`
// DeviceId The player device ID
DeviceId string `json:"device_id"`
// DeviceName The player device name
DeviceName string `json:"device_name"`
// DeviceType The player device type, for example COMPUTER or SPEAKER
DeviceType string `json:"device_type"`
// NextTrack The upcoming track when its metadata is cached (metadata.enabled), so clients can pre-warm its name and cover art before the user skips to it. Absent when unknown.
NextTrack *ApiTrack `json:"next_track,omitempty"`
// Paused Whether the player is paused
Paused bool `json:"paused"`
// PlayOrigin Who started the playback, "go-librespot" identifies the API as the play origin, everything else is Spotify own stuff, null when nothing has started playback yet
PlayOrigin *string `json:"play_origin"`
// PlayOriginDeviceId The device ID that sent the command starting the playback, null when the playback was started locally through this API
PlayOriginDeviceId *string `json:"play_origin_device_id"`
// RepeatContext Whether the repeat context feature is enabled
RepeatContext bool `json:"repeat_context"`
// RepeatTrack Whether the repeat track feature is enabled
RepeatTrack bool `json:"repeat_track"`
// ShuffleContext Whether the shuffle context feature is enabled
ShuffleContext bool `json:"shuffle_context"`
// Stopped Whether the player is stopped
Stopped bool `json:"stopped"`
Track *ApiTrack `json:"track"`
// Username Currently active account's username
Username string `json:"username"`
// Volume The player current volume from 0 to max
Volume uint32 `json:"volume"`
// VolumeSteps The player max volume value
VolumeSteps uint32 `json:"volume_steps"`
}
ApiStatus The player status
type ApiToken ¶ added in v0.9.0
type ApiToken struct {
// Token The access token
Token string `json:"token"`
}
ApiToken A Spotify access token for the active session
type ApiTrack ¶ added in v0.9.0
type ApiTrack struct {
// AlbumCoverUrl Album cover URL
AlbumCoverUrl *string `json:"album_cover_url"`
// AlbumName Album name
AlbumName string `json:"album_name"`
// ArtistNames Artists name
ArtistNames []string `json:"artist_names"`
// BitDepth Bits per sample of the source audio, null for lossy formats which have no meaningful source bit depth
BitDepth *int `json:"bit_depth"`
// Bitrate Nominal bitrate in kbps, null for formats without a fixed one such as FLAC
Bitrate *int `json:"bitrate"`
// Codec Codec family of the audio file
Codec TrackCodec `json:"codec"`
// DiscNumber Disc number within the album, zero for episodes
DiscNumber int `json:"disc_number"`
// Duration Duration in milliseconds
Duration int `json:"duration"`
// Format Spotify name of the audio file being decoded, for example OGG_VORBIS_160
Format string `json:"format"`
// Name Name
Name string `json:"name"`
// Position Playback position in milliseconds
Position int64 `json:"position"`
// ReleaseDate Album release date, empty for episodes
ReleaseDate string `json:"release_date"`
// SampleRate Sample rate of the decoded audio in Hz
SampleRate *int `json:"sample_rate"`
// TrackNumber Track number within the disc, zero for episodes
TrackNumber int `json:"track_number"`
// Uri URI
Uri string `json:"uri"`
}
ApiTrack A track or podcast episode
type ApiVolume ¶ added in v0.9.0
type ApiVolume struct {
// Max The max volume value
Max uint32 `json:"max"`
// Value The current volume, ranging from 0 to max
Value uint32 `json:"value"`
}
ApiVolume The player volume settings
type App ¶
type App struct {
// contains filtered or unexported fields
}
func (*App) Run ¶
Run starts the daemon. It blocks until ctx is cancelled or an unrecoverable error occurs. The credential type configured in cfg.Credentials.Type determines which login flow is used.
func (*App) SetDeviceName ¶ added in v0.7.3
type AppPlayer ¶
type AppPlayer struct {
// contains filtered or unexported fields
}
AppPlayer owns the player's state and is the only thing that may touch it. Everything it holds is read and written from the one goroutine running Run, with no locking, which is what keeps the state consistent without any.
The rule that makes that work: nothing reached from Run's select may block. Anything that talks to the network, the disk or a peer belongs on one of the lanes — the loader for track and context work, the state pusher for connect-state, a detached goroutine for what nobody waits on — and comes back as a result applied here. A handler that blocks stalls playback control, stops the dealer socket being read, and delays the state pushes controllers rely on to know the device is alive.
func (*AppPlayer) Close ¶
func (p *AppPlayer) Close()
Close stops the player and releases its session. It may be called while Run is still busy serving a command, so it must not assume Run reacts promptly: cancelling the context is what actually unblocks in-flight requests.
func (*AppPlayer) CountryCode ¶ added in v0.10.0
CountryCode reports the country the account is registered in, empty until the accesspoint has said. Safe to call from any goroutine.
func (*AppPlayer) Run ¶
func (p *AppPlayer) Run(apiRecv <-chan ApiRequest, mprisRecv <-chan mpris.MediaPlayer2PlayerCommand)
type CacheConfig ¶ added in v0.8.0
type CacheConfig struct {
// Enabled turns the audio file cache on or off.
Enabled bool
// Dir is the directory the cache is stored in.
Dir string
// SizeLimit is the maximum total size of the cached audio files in bytes.
// A value of zero disables eviction (unbounded cache).
SizeLimit int64
}
CacheConfig configures the on-disk cache for downloaded (encrypted) audio files.
type ConcreteApiServer ¶
type ConcreteApiServer struct {
// contains filtered or unexported fields
}
func (*ConcreteApiServer) Close ¶
func (s *ConcreteApiServer) Close() error
func (*ConcreteApiServer) Emit ¶
func (s *ConcreteApiServer) Emit(ev *ApiEvent)
func (*ConcreteApiServer) GetAuthCode ¶ added in v0.9.1
func (s *ConcreteApiServer) GetAuthCode(w http.ResponseWriter, _ *http.Request)
func (*ConcreteApiServer) GetContextTracks ¶ added in v0.10.0
func (s *ConcreteApiServer) GetContextTracks(w http.ResponseWriter, _ *http.Request, params GetContextTracksParams)
func (*ConcreteApiServer) GetEvents ¶ added in v0.9.0
func (s *ConcreteApiServer) GetEvents(w http.ResponseWriter, r *http.Request)
func (*ConcreteApiServer) GetRoot ¶ added in v0.9.0
func (s *ConcreteApiServer) GetRoot(w http.ResponseWriter, _ *http.Request)
func (*ConcreteApiServer) GetStatus ¶ added in v0.9.0
func (s *ConcreteApiServer) GetStatus(w http.ResponseWriter, _ *http.Request)
func (*ConcreteApiServer) GetToken ¶ added in v0.9.0
func (s *ConcreteApiServer) GetToken(w http.ResponseWriter, _ *http.Request)
func (*ConcreteApiServer) PlayerAddToQueue ¶ added in v0.9.0
func (s *ConcreteApiServer) PlayerAddToQueue(w http.ResponseWriter, r *http.Request)
func (*ConcreteApiServer) PlayerGetVolume ¶ added in v0.9.0
func (s *ConcreteApiServer) PlayerGetVolume(w http.ResponseWriter, _ *http.Request)
func (*ConcreteApiServer) PlayerNext ¶ added in v0.9.0
func (s *ConcreteApiServer) PlayerNext(w http.ResponseWriter, r *http.Request)
func (*ConcreteApiServer) PlayerOutput ¶ added in v0.9.0
func (s *ConcreteApiServer) PlayerOutput(w http.ResponseWriter, r *http.Request)
func (*ConcreteApiServer) PlayerPause ¶ added in v0.9.0
func (s *ConcreteApiServer) PlayerPause(w http.ResponseWriter, _ *http.Request)
func (*ConcreteApiServer) PlayerPlay ¶ added in v0.9.0
func (s *ConcreteApiServer) PlayerPlay(w http.ResponseWriter, r *http.Request)
func (*ConcreteApiServer) PlayerPlayPause ¶ added in v0.9.0
func (s *ConcreteApiServer) PlayerPlayPause(w http.ResponseWriter, _ *http.Request)
func (*ConcreteApiServer) PlayerPrev ¶ added in v0.9.0
func (s *ConcreteApiServer) PlayerPrev(w http.ResponseWriter, _ *http.Request)
func (*ConcreteApiServer) PlayerRepeatContext ¶ added in v0.9.0
func (s *ConcreteApiServer) PlayerRepeatContext(w http.ResponseWriter, r *http.Request)
func (*ConcreteApiServer) PlayerRepeatTrack ¶ added in v0.9.0
func (s *ConcreteApiServer) PlayerRepeatTrack(w http.ResponseWriter, r *http.Request)
func (*ConcreteApiServer) PlayerResume ¶ added in v0.9.0
func (s *ConcreteApiServer) PlayerResume(w http.ResponseWriter, _ *http.Request)
func (*ConcreteApiServer) PlayerSeek ¶ added in v0.9.0
func (s *ConcreteApiServer) PlayerSeek(w http.ResponseWriter, r *http.Request)
func (*ConcreteApiServer) PlayerSetVolume ¶ added in v0.9.0
func (s *ConcreteApiServer) PlayerSetVolume(w http.ResponseWriter, r *http.Request)
func (*ConcreteApiServer) PlayerShuffleContext ¶ added in v0.9.0
func (s *ConcreteApiServer) PlayerShuffleContext(w http.ResponseWriter, r *http.Request)
func (*ConcreteApiServer) PlayerStop ¶ added in v0.9.0
func (s *ConcreteApiServer) PlayerStop(w http.ResponseWriter, _ *http.Request)
func (*ConcreteApiServer) Receive ¶
func (s *ConcreteApiServer) Receive() <-chan ApiRequest
func (*ConcreteApiServer) SetAuthCode ¶ added in v0.9.1
func (s *ConcreteApiServer) SetAuthCode(auth *ApiDeviceAuth)
func (*ConcreteApiServer) SetDeviceName ¶ added in v0.9.0
func (s *ConcreteApiServer) SetDeviceName(w http.ResponseWriter, r *http.Request)
type Config ¶
type Config struct {
DeviceId string
DeviceName string
DeviceType string
ClientToken string
AudioBackend string
AudioBackendRuntimeSocket string
AudioDevice string
MixerDevice string
MixerControlName string
AudioBufferTime int
AudioPeriodCount int
AudioOutputPipe string
AudioOutputPipeFormat string
AudioOutputPipeWaitForReader bool
Bitrate int
VolumeSteps uint32
InitialVolume uint32
IgnoreLastVolume bool
NormalisationDisabled bool
NormalisationUseAlbumGain bool
NormalisationPregain float32
CrossfadeDuration int
ExternalVolume bool
DisableAutoplay bool
// SkipDebounce is how long a skip that follows another within this window
// waits before loading the track it landed on, so that a burst of next or
// prev presses costs one load rather than one per press. Zero loads every
// skip immediately.
SkipDebounce time.Duration
ZeroconfEnabled bool
ZeroconfPort int
ZeroconfBackend string
ZeroconfInterfacesToAdvertise []string
FlacEnabled bool
// PreferFirewallFriendlyPorts tries accesspoints on 443 and 80 before the
// default 4070, which some networks block outbound.
PreferFirewallFriendlyPorts bool
// ImageSize selects which cover-art image variant the API server returns:
// "default", "small", "medium", "large", "xlarge".
ImageSize string
Cache CacheConfig
Metadata MetadataConfig
Credentials CredentialsConfig
}
Config carries the runtime configuration for a daemon instance.
type CredentialsConfig ¶
type CredentialsConfig struct {
Type string
Interactive InteractiveCredentials
SpotifyToken SpotifyTokenCredentials
Zeroconf ZeroconfCredentials
}
type GetContextTracksParams ¶ added in v0.10.0
type GetContextTracksParams struct {
// Uri Spotify context URI (playlist, album, artist, show, collection)
Uri string `form:"uri" json:"uri"`
}
GetContextTracksParams defines parameters for GetContextTracks.
type InteractiveCredentials ¶
type InteractiveCredentials struct {
CallbackPort int
}
type InvalidParamFormatError ¶ added in v0.9.0
func (*InvalidParamFormatError) Error ¶ added in v0.9.0
func (e *InvalidParamFormatError) Error() string
func (*InvalidParamFormatError) Unwrap ¶ added in v0.9.0
func (e *InvalidParamFormatError) Unwrap() error
type MetadataConfig ¶ added in v0.10.0
type MetadataConfig struct {
// Enabled turns on the metadata cache, the batched fetch of metadata for
// the tracks around the playback position, and the /context/tracks
// endpoint. Off, the daemon performs no metadata request playback does not
// need.
Enabled bool
// ContextSweep additionally resolves metadata for the whole context when
// one starts playing, so every track is known before the user skips
// anywhere. Requires Enabled.
ContextSweep bool
// MaxTracks caps how many tracks of a context are enumerated and swept.
MaxTracks int
}
MetadataConfig configures the in-memory track metadata cache behind the next_track status field and the /context/tracks listing. Everything here is opt-in: a headless speaker has no use for metadata beyond the playing track and should not pay network requests for it.
type Options ¶
type Options struct {
Logger librespot.Logger
Config *Config
StateStore librespot.StateStore
APIServer ApiServer
MediaPlayer mpris.Server
}
Options bundles the dependencies a daemon needs at construction time.
type PlayerAddToQueueJSONRequestBody ¶ added in v0.9.0
type PlayerAddToQueueJSONRequestBody = ApiAddToQueue
PlayerAddToQueueJSONRequestBody defines body for PlayerAddToQueue for application/json ContentType.
type PlayerNextJSONRequestBody ¶ added in v0.9.0
type PlayerNextJSONRequestBody = ApiNext
PlayerNextJSONRequestBody defines body for PlayerNext for application/json ContentType.
type PlayerOutputJSONRequestBody ¶ added in v0.9.0
type PlayerOutputJSONRequestBody = ApiOutput
PlayerOutputJSONRequestBody defines body for PlayerOutput for application/json ContentType.
type PlayerPlayJSONRequestBody ¶ added in v0.9.0
type PlayerPlayJSONRequestBody = ApiPlay
PlayerPlayJSONRequestBody defines body for PlayerPlay for application/json ContentType.
type PlayerRepeatContextJSONRequestBody ¶ added in v0.9.0
type PlayerRepeatContextJSONRequestBody = ApiRepeatContext
PlayerRepeatContextJSONRequestBody defines body for PlayerRepeatContext for application/json ContentType.
type PlayerRepeatTrackJSONRequestBody ¶ added in v0.9.0
type PlayerRepeatTrackJSONRequestBody = ApiRepeatTrack
PlayerRepeatTrackJSONRequestBody defines body for PlayerRepeatTrack for application/json ContentType.
type PlayerSeekJSONRequestBody ¶ added in v0.9.0
type PlayerSeekJSONRequestBody = ApiSeek
PlayerSeekJSONRequestBody defines body for PlayerSeek for application/json ContentType.
type PlayerSetVolumeJSONRequestBody ¶ added in v0.9.0
type PlayerSetVolumeJSONRequestBody = ApiSetVolume
PlayerSetVolumeJSONRequestBody defines body for PlayerSetVolume for application/json ContentType.
type PlayerShuffleContextJSONRequestBody ¶ added in v0.9.0
type PlayerShuffleContextJSONRequestBody = ApiShuffleContext
PlayerShuffleContextJSONRequestBody defines body for PlayerShuffleContext for application/json ContentType.
type ProductInfo ¶
type ProductInfo struct {
XMLName xml.Name `xml:"products"`
Products []struct {
XMLName xml.Name `xml:"product"`
Type string `xml:"type"`
HeadFilesUrl string `xml:"head-files-url"`
ImageUrl string `xml:"image-url"`
} `xml:"product"`
}
func (ProductInfo) ImageUrl ¶
func (pi ProductInfo) ImageUrl(fileId []byte) *string
type RequiredHeaderError ¶ added in v0.9.0
func (*RequiredHeaderError) Error ¶ added in v0.9.0
func (e *RequiredHeaderError) Error() string
func (*RequiredHeaderError) Unwrap ¶ added in v0.9.0
func (e *RequiredHeaderError) Unwrap() error
type RequiredParamError ¶ added in v0.9.0
type RequiredParamError struct {
ParamName string
}
func (*RequiredParamError) Error ¶ added in v0.9.0
func (e *RequiredParamError) Error() string
type ServeMux ¶ added in v0.9.0
type ServeMux interface {
HandleFunc(pattern string, handler func(http.ResponseWriter, *http.Request))
ServeHTTP(w http.ResponseWriter, r *http.Request)
}
ServeMux is an abstraction of http.ServeMux.
type ServerInterface ¶ added in v0.9.0
type ServerInterface interface {
// (GET /)
GetRoot(w http.ResponseWriter, r *http.Request)
// (GET /auth/code)
GetAuthCode(w http.ResponseWriter, r *http.Request)
// (GET /context/tracks)
GetContextTracks(w http.ResponseWriter, r *http.Request, params GetContextTracksParams)
// (GET /events)
GetEvents(w http.ResponseWriter, r *http.Request)
// (POST /player/add_to_queue)
PlayerAddToQueue(w http.ResponseWriter, r *http.Request)
// (POST /player/next)
PlayerNext(w http.ResponseWriter, r *http.Request)
// (POST /player/output)
PlayerOutput(w http.ResponseWriter, r *http.Request)
// (POST /player/pause)
PlayerPause(w http.ResponseWriter, r *http.Request)
// (POST /player/play)
PlayerPlay(w http.ResponseWriter, r *http.Request)
// (POST /player/playpause)
PlayerPlayPause(w http.ResponseWriter, r *http.Request)
// (POST /player/prev)
PlayerPrev(w http.ResponseWriter, r *http.Request)
// (POST /player/repeat_context)
PlayerRepeatContext(w http.ResponseWriter, r *http.Request)
// (POST /player/repeat_track)
PlayerRepeatTrack(w http.ResponseWriter, r *http.Request)
// (POST /player/resume)
PlayerResume(w http.ResponseWriter, r *http.Request)
// (POST /player/seek)
PlayerSeek(w http.ResponseWriter, r *http.Request)
// (POST /player/shuffle_context)
PlayerShuffleContext(w http.ResponseWriter, r *http.Request)
// (POST /player/stop)
PlayerStop(w http.ResponseWriter, r *http.Request)
// (GET /player/volume)
PlayerGetVolume(w http.ResponseWriter, r *http.Request)
// (POST /player/volume)
PlayerSetVolume(w http.ResponseWriter, r *http.Request)
// (POST /set_device_name)
SetDeviceName(w http.ResponseWriter, r *http.Request)
// (GET /status)
GetStatus(w http.ResponseWriter, r *http.Request)
// (POST /token)
GetToken(w http.ResponseWriter, r *http.Request)
}
ServerInterface represents all server handlers.
type ServerInterfaceWrapper ¶ added in v0.9.0
type ServerInterfaceWrapper struct {
Handler ServerInterface
HandlerMiddlewares []MiddlewareFunc
ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error)
}
ServerInterfaceWrapper converts contexts to parameters.
func (*ServerInterfaceWrapper) GetAuthCode ¶ added in v0.9.1
func (siw *ServerInterfaceWrapper) GetAuthCode(w http.ResponseWriter, r *http.Request)
GetAuthCode operation middleware
func (*ServerInterfaceWrapper) GetContextTracks ¶ added in v0.10.0
func (siw *ServerInterfaceWrapper) GetContextTracks(w http.ResponseWriter, r *http.Request)
GetContextTracks operation middleware
func (*ServerInterfaceWrapper) GetEvents ¶ added in v0.9.0
func (siw *ServerInterfaceWrapper) GetEvents(w http.ResponseWriter, r *http.Request)
GetEvents operation middleware
func (*ServerInterfaceWrapper) GetRoot ¶ added in v0.9.0
func (siw *ServerInterfaceWrapper) GetRoot(w http.ResponseWriter, r *http.Request)
GetRoot operation middleware
func (*ServerInterfaceWrapper) GetStatus ¶ added in v0.9.0
func (siw *ServerInterfaceWrapper) GetStatus(w http.ResponseWriter, r *http.Request)
GetStatus operation middleware
func (*ServerInterfaceWrapper) GetToken ¶ added in v0.9.0
func (siw *ServerInterfaceWrapper) GetToken(w http.ResponseWriter, r *http.Request)
GetToken operation middleware
func (*ServerInterfaceWrapper) PlayerAddToQueue ¶ added in v0.9.0
func (siw *ServerInterfaceWrapper) PlayerAddToQueue(w http.ResponseWriter, r *http.Request)
PlayerAddToQueue operation middleware
func (*ServerInterfaceWrapper) PlayerGetVolume ¶ added in v0.9.0
func (siw *ServerInterfaceWrapper) PlayerGetVolume(w http.ResponseWriter, r *http.Request)
PlayerGetVolume operation middleware
func (*ServerInterfaceWrapper) PlayerNext ¶ added in v0.9.0
func (siw *ServerInterfaceWrapper) PlayerNext(w http.ResponseWriter, r *http.Request)
PlayerNext operation middleware
func (*ServerInterfaceWrapper) PlayerOutput ¶ added in v0.9.0
func (siw *ServerInterfaceWrapper) PlayerOutput(w http.ResponseWriter, r *http.Request)
PlayerOutput operation middleware
func (*ServerInterfaceWrapper) PlayerPause ¶ added in v0.9.0
func (siw *ServerInterfaceWrapper) PlayerPause(w http.ResponseWriter, r *http.Request)
PlayerPause operation middleware
func (*ServerInterfaceWrapper) PlayerPlay ¶ added in v0.9.0
func (siw *ServerInterfaceWrapper) PlayerPlay(w http.ResponseWriter, r *http.Request)
PlayerPlay operation middleware
func (*ServerInterfaceWrapper) PlayerPlayPause ¶ added in v0.9.0
func (siw *ServerInterfaceWrapper) PlayerPlayPause(w http.ResponseWriter, r *http.Request)
PlayerPlayPause operation middleware
func (*ServerInterfaceWrapper) PlayerPrev ¶ added in v0.9.0
func (siw *ServerInterfaceWrapper) PlayerPrev(w http.ResponseWriter, r *http.Request)
PlayerPrev operation middleware
func (*ServerInterfaceWrapper) PlayerRepeatContext ¶ added in v0.9.0
func (siw *ServerInterfaceWrapper) PlayerRepeatContext(w http.ResponseWriter, r *http.Request)
PlayerRepeatContext operation middleware
func (*ServerInterfaceWrapper) PlayerRepeatTrack ¶ added in v0.9.0
func (siw *ServerInterfaceWrapper) PlayerRepeatTrack(w http.ResponseWriter, r *http.Request)
PlayerRepeatTrack operation middleware
func (*ServerInterfaceWrapper) PlayerResume ¶ added in v0.9.0
func (siw *ServerInterfaceWrapper) PlayerResume(w http.ResponseWriter, r *http.Request)
PlayerResume operation middleware
func (*ServerInterfaceWrapper) PlayerSeek ¶ added in v0.9.0
func (siw *ServerInterfaceWrapper) PlayerSeek(w http.ResponseWriter, r *http.Request)
PlayerSeek operation middleware
func (*ServerInterfaceWrapper) PlayerSetVolume ¶ added in v0.9.0
func (siw *ServerInterfaceWrapper) PlayerSetVolume(w http.ResponseWriter, r *http.Request)
PlayerSetVolume operation middleware
func (*ServerInterfaceWrapper) PlayerShuffleContext ¶ added in v0.9.0
func (siw *ServerInterfaceWrapper) PlayerShuffleContext(w http.ResponseWriter, r *http.Request)
PlayerShuffleContext operation middleware
func (*ServerInterfaceWrapper) PlayerStop ¶ added in v0.9.0
func (siw *ServerInterfaceWrapper) PlayerStop(w http.ResponseWriter, r *http.Request)
PlayerStop operation middleware
func (*ServerInterfaceWrapper) SetDeviceName ¶ added in v0.9.0
func (siw *ServerInterfaceWrapper) SetDeviceName(w http.ResponseWriter, r *http.Request)
SetDeviceName operation middleware
type SetDeviceNameJSONRequestBody ¶ added in v0.9.0
type SetDeviceNameJSONRequestBody = ApiSetDeviceName
SetDeviceNameJSONRequestBody defines body for SetDeviceName for application/json ContentType.
type SpotifyTokenCredentials ¶
type StdHTTPServerOptions ¶ added in v0.9.0
type StdHTTPServerOptions struct {
BaseURL string
BaseRouter ServeMux
Middlewares []MiddlewareFunc
ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error)
}
type StubApiServer ¶
type StubApiServer struct {
// contains filtered or unexported fields
}
func (*StubApiServer) Close ¶
func (s *StubApiServer) Close() error
func (*StubApiServer) Emit ¶
func (s *StubApiServer) Emit(ev *ApiEvent)
func (*StubApiServer) Receive ¶
func (s *StubApiServer) Receive() <-chan ApiRequest
func (*StubApiServer) SetAuthCode ¶ added in v0.9.1
func (s *StubApiServer) SetAuthCode(*ApiDeviceAuth)
type TooManyValuesForParamError ¶ added in v0.9.0
func (*TooManyValuesForParamError) Error ¶ added in v0.9.0
func (e *TooManyValuesForParamError) Error() string
type TrackCodec ¶ added in v0.9.0
type TrackCodec string
TrackCodec Codec family of the audio file
const ( TrackCodecAac TrackCodec = "aac" TrackCodecEmpty TrackCodec = "" TrackCodecFlac TrackCodec = "flac" TrackCodecMp3 TrackCodec = "mp3" TrackCodecUnknown TrackCodec = "unknown" TrackCodecVorbis TrackCodec = "vorbis" )
Defines values for TrackCodec.
type UnescapedCookieParamError ¶ added in v0.9.0
func (*UnescapedCookieParamError) Error ¶ added in v0.9.0
func (e *UnescapedCookieParamError) Error() string
func (*UnescapedCookieParamError) Unwrap ¶ added in v0.9.0
func (e *UnescapedCookieParamError) Unwrap() error
type UnmarshalingParamError ¶ added in v0.9.0
func (*UnmarshalingParamError) Error ¶ added in v0.9.0
func (e *UnmarshalingParamError) Error() string
func (*UnmarshalingParamError) Unwrap ¶ added in v0.9.0
func (e *UnmarshalingParamError) Unwrap() error
type ZeroconfCredentials ¶
type ZeroconfCredentials struct {
PersistCredentials bool
}