pkg

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2021 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PackageVersion string = "default version"

PackageVersion contains the package version

Functions

This section is empty.

Types

type Carrier

type Carrier struct {
	XMLName xml.Name `xml:"https://www.inurbanus.nl/NS/speeldoos/1.0 Carrier"`

	Name string

	// A catalog number, or some other unique identifier within the collection
	ID string `xml:",omitempty"`

	// The SHA256 hash of the corresponding .zip bundle for this carrier.
	Hash string `xml:"hash,attr,omitempty"`

	// An indication of how this carrier ended up in this library.
	// Suggested values:
	//   * "WEB" (digital download)
	//   * "CD" (ripped cd)
	Source string `xml:"source,attr,omitempty"`

	// The performances on this carrier
	Performances []Performance `xml:"Performances>Performance"`
}

A Carrier can represent either a physical medium or a packaged download. An "album," in layman's terms.

func ImportCarrier

func ImportCarrier(filename string) (*Carrier, error)

ImportCarrier reads a serialized Carrier from a file

func (*Carrier) Write

func (c *Carrier) Write(filename string) error

Write serialises the carrier to disk

type Composer

type Composer struct {
	Name string

	// A composer's ID is the page ID for their Wikipedia page
	ID string `xml:"id,attr,omitempty"`
}

A Composer represents a composer

type Library

type Library struct {
	LibraryDir string
	WAVConf    wavreader.Config
	Carriers   []ParsedCarrier
	// contains filtered or unexported fields
}

A Library consists of a collection of Carriers

func NewLibrary

func NewLibrary(dir string) *Library

NewLibrary instantiates a new Library with the specified base directory

func (*Library) AllCarriers

func (l *Library) AllCarriers() []ParsedCarrier

AllCarriers filters all Carriers in the library, and returns those that are error-free

func (*Library) GetWAV

func (l *Library) GetWAV(pf Performance) (wavreader.Reader, error)

GetWAV opens one performance in the library and return its raw audio data

func (*Library) NewScheduler added in v0.5.0

func (l *Library) NewScheduler(wc chunker.WAVChunkConfig) (*Scheduler, error)

func (*Library) Refresh

func (l *Library) Refresh() error

Refresh (re-)reads all XML files from disk, parsing any speeldoos files

type OpusNumber

type OpusNumber struct {
	Number string `xml:",chardata"`

	// Some composers use a different index (e.g. 'BWV', 'KV', 'Wq', etc.)
	IndexName string `xml:",attr,omitempty"`
}

An OpusNumber represents an opus number for a composition. Opus numbers, together with the composer, ideally uniquely identify a work

func (OpusNumber) String

func (o OpusNumber) String() string

type ParsedCarrier

type ParsedCarrier struct {
	// The full path to the xml file
	Filename string

	// The parsed Carrier, if successful
	Carrier *Carrier

	// The parse error, if applicable
	Error error
}

A ParsedCarrier wraps a Carrier object together with the file name it came from

type Part

type Part struct {
	Part   string `xml:",chardata"`
	Number string `xml:"number,attr,omitempty"`
}

A Part of a work

type Performance

type Performance struct {
	Work Work

	// The year in which the performance took place
	Year int `xml:",omitempty"`

	Performers  []Performer  `xml:"Performers>Performer"`
	SourceFiles []SourceFile `xml:"SourceFiles>File"`
}

A Performance represents one (recording of a) performance of a Work.

type Performer

type Performer struct {
	Name string `xml:",chardata"`

	// The type of performer. Suggested values:
	//   * "performer"
	//   * "soloist"
	//   * "orchestra"
	//   * "ensemble"
	//   * "conductor"
	Role string `xml:"role,attr,omitempty"`
}

A Performer in one particular recording of a Work. An 'artist', if you will.

type Scheduler added in v0.5.0

type Scheduler struct {
	Library     *Library
	AudioStream chunker.Chunker
}

func (*Scheduler) NextPerformance added in v0.5.0

func (s *Scheduler) NextPerformance() Performance

func (*Scheduler) Run added in v0.5.0

func (s *Scheduler) Run(ctx context.Context)

type SourceFile

type SourceFile struct {
	Filename string `xml:",chardata"`

	// The disc number, if applicable.
	Disc int `xml:"disc,attr,omitempty"`
}

A SourceFile wraps the path to a file containing the recording of that particular performance

func (SourceFile) String

func (s SourceFile) String() string

type Title

type Title struct {
	Title    string `xml:",chardata"`
	Language string `xml:",attr,omitempty"`
}

A Title represents a work's title in a certain language

type Work

type Work struct {
	Composer Composer

	// A work may have more than one title in different languages.
	Title []Title

	// The opus number(s) for this composition. There may be more than one index
	// for identifying works by this particular composer. Or none at all. Or
	// this work may just not appear on any of them.
	OpusNumber []OpusNumber

	// The parts that comprise this work, if any.
	Parts []Part `xml:"Parts>Part,omitempty"`

	// The year this composition was completed.
	Year int
}

A Work represents a musical composition.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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