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 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)
// Playlists lists the user's playlists in the server's order.
Playlists(ctx context.Context) ([]Playlist, error)
// PlaylistTracks returns a playlist's tracks in playlist order.
PlaylistTracks(ctx context.Context, playlistID string) ([]Track, error)
// CreatePlaylist makes a new playlist holding tracks, in order, and
// returns it. Every track must belong to this library.
CreatePlaylist(ctx context.Context, name string, tracks []Track) (Playlist, error)
Stream(ctx context.Context, t Track) (Stream, error)
}
type SearchResult ¶
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
}
func (Track) Quality ¶ added in v0.9.2
Quality is a short label for the track's format, the kind a player prints beside an album so two copies at different quality read apart: "FLAC 16/44.1", "FLAC 24/96", "MP3 320k", "AAC 256k". Lossless codecs show bit depth and sample rate; lossy ones show the bitrate. Empty when the codec is unknown.