library

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2026 License: MIT Imports: 2 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 library is the seam between the player and a music server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Album

type Album struct {
	ID, Title, Artist, ArtistID string
	Year, TrackCount            int
	AddedAt                     int64
	Server                      string // which server the album lives on
}

type Artist

type Artist struct{ ID, Name, Server string }

type Letter

type Letter struct {
	Letter string
	Count  int
}

Letter is one entry of the artist index: how many artists sort under it.

type Library

type Library interface {
	Search(ctx context.Context, query string) (SearchResult, error)
	RecentAlbums(ctx context.Context, offset, limit int) ([]Album, error)
	AlbumTracks(ctx context.Context, albumID string) ([]Track, error)
	ArtistAlbums(ctx context.Context, artistID string) ([]Album, error)
	// Artists returns a page of all artists in sort order and the total count.
	Artists(ctx context.Context, offset, limit int) ([]Artist, int, error)
	// ArtistIndex returns the first letters artists sort under, in sort order.
	ArtistIndex(ctx context.Context) ([]Letter, error)
	Stream(ctx context.Context, t Track) (Stream, error)
}

type SearchResult

type SearchResult struct {
	Artists []Artist
	Albums  []Album
	Tracks  []Track
}

type Stream

type Stream struct {
	URL     string
	Codec   string // codec of the bytes at URL: "flac" or "mp3"
	Headers map[string]string
}

type Track

type Track struct {
	ID, Title, Artist, Album, AlbumID string
	Index                             int
	Duration                          time.Duration
	Codec                             string // "flac", "mp3", "aac"
	Container                         string
	PartKey                           string // server-relative path of the media file, e.g. /library/parts/1/1/file.flac
	Bitrate, SampleRate, BitDepth     int
	Server                            string // which server the track lives on
}

Jump to

Keyboard shortcuts

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