Documentation
¶
Overview ¶
Package model contains the player and catalog data shared by Smolify's native and browser hosts. It has no player, filesystem, or host imports.
Index ¶
- Constants
- Variables
- func AudioBackendOptions(goos string) []string
- func KnownAudioBackend(goos, backend string) bool
- func LikedSongs(username string) string
- func ResolveAudioBackend(goos, setting, override string) (string, error)
- type Audio
- type Event
- type Failed
- type Listing
- type Pairing
- type Paused
- type PlaybackError
- type Played
- type Playing
- type Playlist
- type Ready
- type Repeat
- type Seek
- type Shuffle
- type Status
- type Stopped
- type Track
- type Volume
- type WillPlay
Constants ¶
const AudioBackendAuto = "auto"
AudioBackendAuto selects Smolify's default output driver for the OS.
const AudioBackendEnv = "SMOLIFY_AUDIO_BACKEND"
AudioBackendEnv is the environment variable that overrides the saved output driver.
Variables ¶
var ErrSuperseded = errors.New("player: command superseded")
ErrSuperseded reports a command that a newer command replaced before it ran.
Functions ¶
func AudioBackendOptions ¶ added in v0.1.2
AudioBackendOptions are the output drivers Smolify can use on goos, with AudioBackendAuto first; none in a browser, which plays through its own player. go-librespot's pipe driver is left out: it needs a FIFO path.
func KnownAudioBackend ¶ added in v0.1.2
KnownAudioBackend reports whether backend is one of goos's options.
func LikedSongs ¶
LikedSongs is the context URI of a user's Liked Songs.
func ResolveAudioBackend ¶ added in v0.1.2
ResolveAudioBackend is the output driver to use on goos: the override (the environment) when set, else the saved setting, with "" and AudioBackendAuto meaning the OS default.
Types ¶
type Audio ¶
type Audio struct {
// Backend is the output driver, or AudioBackendAuto (or "") for the OS
// default. Native players only.
Backend string
Bitrate int
Normalise bool
Crossfade time.Duration
Autoplay bool
}
Audio is how a player plays. Browser players may ignore settings they do not expose.
type Event ¶
type Event interface {
// contains filtered or unexported methods
}
Event is a player or browser playback event. The set is closed.
type Paused ¶
type Paused struct{ URI, ContextURI string }
WillPlay identifies the track a player is about to load. Playing and Paused report confirmed playback state.
type PlaybackError ¶
PlaybackError reports a track that failed to play.
type Playing ¶
type Playing struct{ URI, ContextURI string }
WillPlay identifies the track a player is about to load. Playing and Paused report confirmed playback state.
type Playlist ¶
type Playlist struct {
URI, Name, Description, Owner string
Image string
Length int
Folder []string
}
Playlist is a playlist in the user's library.
type Repeat ¶
type Repeat struct{ Context, Track bool }
WillPlay identifies the track a player is about to load. Playing and Paused report confirmed playback state.
type Seek ¶
WillPlay identifies the track a player is about to load. Playing and Paused report confirmed playback state.
type Shuffle ¶
type Shuffle struct{ On bool }
WillPlay identifies the track a player is about to load. Playing and Paused report confirmed playback state.
type Status ¶
type Status struct {
Username string
Track *Track
Paused, Stopped bool
Volume, VolumeSteps int
Shuffle bool
Repeat Repeat
ContextURI string
}
Status is the current player state.
type Stopped ¶
type Stopped struct{}
WillPlay identifies the track a player is about to load. Playing and Paused report confirmed playback state.
type Track ¶
type Track struct {
URI, Name string
Artists []string
ArtistURIs []string
Album, AlbumURI string
Cover string
AddedAt time.Time
Duration time.Duration
Position time.Duration
ContextURI string
TrackNumber, Disc int
}
Track is a playable item and its catalog metadata.