librespot

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultBackend    = "subprocess"
	DefaultDeviceName = "tuify"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	BinaryPath  string // path to librespot binary, default "librespot"
	DeviceName  string // Spotify Connect device name, default DefaultDeviceName
	Bitrate     int    // 96, 160, or 320; default 320
	Backend     string // audio backend: DefaultBackend, "pulseaudio", etc.
	AudioWorker string // full command for subprocess backend (only used when Backend == DefaultBackend)
	Username    string // Spotify username for direct auth (avoids zeroconf key issues)
	CacheDir    string // directory for librespot credential/audio cache
}

Config holds librespot launch parameters.

type Process

type Process struct {
	OnReconnect func() // called when librespot authenticates (initial or restart)
	// contains filtered or unexported fields
}

Process manages a librespot child process with automatic restart on crash.

func NewProcess

func NewProcess(cfg Config) *Process

NewProcess creates a new Process with the given configuration.

func (*Process) Start

func (p *Process) Start() error

Start launches the librespot process. If the process crashes, it will be automatically restarted with backoff proportional to how quickly it died (2s–30s). The delay resets after 60 seconds of stable uptime.

func (*Process) Stop

func (p *Process) Stop() error

Stop sends SIGTERM, waits up to 5 seconds, then SIGKILL. Suppresses any pending or future automatic restarts.

Jump to

Keyboard shortcuts

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