library

package
v0.0.0-...-ecb31cf Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const LEAST_TRACK_FILE_SIZE = 1024 // least size(byte)

Variables

View Source
var ValidTrackFileSuffixes = [2]string{".wav", ".flac"}

Functions

func NewLibraryConfiguration

func NewLibraryConfiguration(lib *Library) *config.LibraryConfiguration

NewLibraryConfiguration initializes a *config.LibraryConfiguration from given *Library.

func ScanLibraryAndSaveConfig

func ScanLibraryAndSaveConfig(libName, libPath string) error

ScanLibraryAndSaveConfig sets up a new library and scans it before saves track infos into config file.

Types

type FLACTrack

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

func (FLACTrack) FileAddr

func (f FLACTrack) FileAddr() string

FileAddr returns complete address of the track file.

func (FLACTrack) String

func (f FLACTrack) String() string

String wraps info of a track to a readable string.

func (FLACTrack) Title

func (f FLACTrack) Title() string

Title returns the title of a track.

type Library

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

Library of tracks is based on a folder and contains tracks in his directory or subdirectories.

func NewLibrary

func NewLibrary(name, path string) (*Library, error)

NewLibrary initializes and returns a library with basic info and empty track list.

func NewLibraryFromConfig

func NewLibraryFromConfig(libconfig *config.LibraryConfiguration) *Library

NewLibraryFromConfig initializes a library from config file, which is faster than scanning local directory.

func (*Library) GetTrackByID

func (l *Library) GetTrackByID(id int) *Track

func (*Library) NumTracks

func (l *Library) NumTracks() int

func (*Library) Scan

func (l *Library) Scan() error

Scan scans tracks for a initialized library(with a path referring to a music folder), scanning a empty library will results in a error.

DEPRECATED: ScanWithRoutines proves to be faster than this one.

func (*Library) ScanWithRoutines

func (l *Library) ScanWithRoutines() error

func (*Library) Sort

func (l *Library) Sort()

func (*Library) String

func (l *Library) String() string

String wraps info of a library to a readable string.

type Track

type Track interface {
	Title() string
	FileAddr() string
	String() string // wraps info of a track to a readable string.
}

func ParseTrack

func ParseTrack(path string, fi os.FileInfo) (Track, error)

ParseTrack trys to parse a file whose path and FileInfo is given as a track.

type WAVTrack

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

func (WAVTrack) FileAddr

func (f WAVTrack) FileAddr() string

FileAddr returns complete address of the track file.

func (WAVTrack) String

func (f WAVTrack) String() string

String wraps info of a track to a readable string.

func (WAVTrack) Title

func (w WAVTrack) Title() string

Title returns the title of a track.

Jump to

Keyboard shortcuts

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