mm

package module
v0.0.0-...-cc4ea22 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2017 License: MIT Imports: 8 Imported by: 0

README

mm

extract music metadata from files

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUnsupportedAudioType = errors.New("cannot detect the type of audio in data")
View Source
var Extractors = map[AudioType]Extractor{
	FLAC: &FlacExtractor{},
	MPEG: &MpegExtractor{},
}

Functions

This section is empty.

Types

type AudioType

type AudioType uint
const (
	FLAC AudioType = iota
	MPEG
)

func DetectAudioType

func DetectAudioType(rs io.ReadSeeker) (*AudioType, error)

DetectAudioType takes a readSeeker and will detect the type of audio based on specific bytes that are present in the first few bytes of a file

type Extractor

type Extractor interface {
	Extract(rs io.ReadSeeker) (*Metadata, error)
}

type FlacExtractor

type FlacExtractor struct{}

FlacExtractor represents the utility used to extract metadata from a FLAC encoded audio file

func (FlacExtractor) Extract

func (ex FlacExtractor) Extract(rs io.ReadSeeker) (*Metadata, error)

Extract will derive Metadata from a FLAC encoded audio file

type Metadata

type Metadata map[MetadataField]string

Metadata is the construct that holds metadata information about a specific audio file

func Parse

func Parse(rs io.ReadSeeker) (*Metadata, error)

Parse takes a filename and automatically looks up an extractor to use

func (Metadata) GetField

func (m Metadata) GetField(f MetadataField) string

GetField safely retrieves a metadata field

func (Metadata) HasField

func (m Metadata) HasField(f MetadataField) bool

HasField tests whether the metadata has a field set or not

func (Metadata) SetField

func (m Metadata) SetField(f MetadataField, v string)

SetField sets a specific field in Metadata

func (Metadata) String

func (m Metadata) String() string

type MetadataField

type MetadataField int8

MetadataField is a type of field that can be found in metadata. Common things like Title, or Artist

const (
	TitleField       MetadataField = 0
	ArtistField      MetadataField = 1
	AlbumField       MetadataField = 2
	AlbumArtistField MetadataField = 3
	YearField        MetadataField = 4

	// GroupingField describes the music label or producers of an audio file
	GroupingField MetadataField = 5

	TrackNumberField MetadataField = 6
	TrackTotalField  MetadataField = 7
	DiscNumberField  MetadataField = 8
	DiscTotalField   MetadataField = 9
)

func (MetadataField) String

func (m MetadataField) String() string

type MpegExtractor

type MpegExtractor struct{}

func (MpegExtractor) Extract

func (ex MpegExtractor) Extract(rs io.ReadSeeker) (*Metadata, error)

Jump to

Keyboard shortcuts

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