Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrUnsupportedAudioType = errors.New("cannot detect the type of audio in data")
var Extractors = map[AudioType]Extractor{ FLAC: &FlacExtractor{}, MPEG: &MpegExtractor{}, }
Functions ¶
This section is empty.
Types ¶
type AudioType ¶
type AudioType uint
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 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
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)