library

package
v0.0.0-...-4aa44aa Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2023 License: AGPL-3.0 Imports: 18 Imported by: 0

Documentation

Overview

Package library is responsible for orchestrating actions related to providing a navigable representation of the audio library.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SortTracks

func SortTracks(tracks []music.Track)

Types

type AccessLoader

type AccessLoader interface {
	Load(file string) (music.Access, error)
}

type DelimiterAccessLoader

type DelimiterAccessLoader struct{}

func NewDelimiterAccessLoader

func NewDelimiterAccessLoader() *DelimiterAccessLoader

func (*DelimiterAccessLoader) Load

func (l *DelimiterAccessLoader) Load(file string) (music.Access, error)

type IdGenerator

type IdGenerator interface {
	AlbumId(parents []music.AlbumId, title string) (music.AlbumId, error)
	TrackId(parents []music.AlbumId, title string) (music.TrackId, error)
	FileId(path string) (music.FileId, error)
}

func NewIdGenerator

func NewIdGenerator() IdGenerator

type Library

type Library struct {
	// contains filtered or unexported fields
}

Library receives scanner updates, dispatches them to appropriate stores and builds a navigable representation of the music collection.

func New

func New(
	ch <-chan scanner.Album,
	trackStore TrackStore,
	thumbnailStore ThumbnailStore,
	accessLoader AccessLoader,
	idGenerator IdGenerator,
) (*Library, error)

New creates a library which receives updates from the specified channel.

func (*Library) Browse

func (l *Library) Browse(ids []music.AlbumId, publicOnly bool) (music.Album, error)

Browse lists the specified album. Provide a zero-length slice to list the root album.

func (*Library) Search

func (l *Library) Search(query string, publicOnly bool) (music.SearchResult, error)

type ThumbnailStore

type ThumbnailStore interface {
	SetItems(items []store.Item)
}

type TrackStore

type TrackStore interface {
	SetItems(items []store.Item)
	GetDuration(id string) time.Duration
}

Jump to

Keyboard shortcuts

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