Documentation
¶
Overview ¶
Package trackmeta reads the tags and cover art of an audio track.
Tag data is untrusted: every read is bounded by a byte cap checked against the size the file declares before anything is parsed, structures whose lengths do not fit the data they sit in are refused before the tag parser sees them, and a panic inside the parser is recovered.
Index ¶
Constants ¶
const ( SourceEmbedded = "embedded" SourceFolder = "folder" )
Picture source names reported by ReadPicture.
Variables ¶
var ( // ErrNoTags is returned when a track has no tags this package reads. ErrNoTags = errors.New("no track tags") // ErrTagsTooLarge is returned when a track declares more tag data than // the cap allows. ErrTagsTooLarge = errors.New("track tags exceed size limit") // ErrMalformedTags is returned when a track's tags do not fit together. ErrMalformedTags = errors.New("malformed track tags") // ErrNoArt is returned by ReadPicture when a track has no cover art. ErrNoArt = errors.New("no cover art") )
Functions ¶
func FolderArtPath ¶
FolderArtPath returns the cover image beside the track at path, if any.
func HasFolderArt ¶
findFolderArt looks for a cover, folder or front image in the directory of the track at path. HasFolderArt reports whether a cover, folder or front image sits beside the track at path.
Types ¶
type Meta ¶
type Meta struct {
Title string
Artist string
Album string
AlbumArtist string
Genre string
Year int
TrackNumber int
TrackTotal int
DiscNumber int
DiscTotal int
// ReplayGainDB is the track's ReplayGain adjustment, valid when
// HasReplayGain is set.
ReplayGainDB float64
HasReplayGain bool
// HasArt reports cover art either embedded in the track or as an image
// beside it.
HasArt bool
}
Meta is what a track's tags say about it. Empty fields were not tagged.