model

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: GPL-3.0 Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
const AudioBackendAuto = "auto"

AudioBackendAuto selects Smolify's default output driver for the OS.

View Source
const AudioBackendEnv = "SMOLIFY_AUDIO_BACKEND"

AudioBackendEnv is the environment variable that overrides the saved output driver.

Variables

View Source
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

func AudioBackendOptions(goos string) []string

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

func KnownAudioBackend(goos, backend string) bool

KnownAudioBackend reports whether backend is one of goos's options.

func LikedSongs

func LikedSongs(username string) string

LikedSongs is the context URI of a user's Liked Songs.

func ResolveAudioBackend added in v0.1.2

func ResolveAudioBackend(goos, setting, override string) (string, error)

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 Failed

type Failed struct{ Err error }

Failed reports that the player stopped with an error.

type Listing

type Listing struct {
	URI    string
	Ready  bool
	Length int
	Cached int
	Tracks []Track
}

Listing is a context's tracks as far as they have been resolved.

func (Listing) Complete

func (l Listing) Complete() bool

Complete reports that every track is listed with its metadata.

type Pairing

type Pairing struct {
	URL, Code string
	Expires   time.Time
}

Pairing asks the user to approve a device.

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

type PlaybackError struct {
	URI, Kind  string
	Unplayable bool
	Message    string
}

PlaybackError reports a track that failed to play.

type Played

type Played struct {
	ContextURI, TrackURI string
	At                   time.Time
}

Played is a recently played context with its last track and time.

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 Ready

type Ready struct{}

Ready reports that the player is ready for requests.

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

type Seek struct{ Position, Duration time.Duration }

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.

type Volume

type Volume struct{ Value, Max int }

WillPlay identifies the track a player is about to load. Playing and Paused report confirmed playback state.

type WillPlay

type WillPlay struct{ URI, ContextURI string }

WillPlay identifies the track a player is about to load. Playing and Paused report confirmed playback state.

Jump to

Keyboard shortcuts

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