Documentation ¶
Overview ¶
Package taglib provides utilities for parsing audio tags in various formats.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrUnrecognizedFormat = errors.New("taglib: format not recognized")
)
Functions ¶
This section is empty.
Types ¶
type GenericTag ¶
type GenericTag interface { Title() string Artist() string Album() string Comment() string Genre() string Year() time.Time Track() uint32 Disc() uint32 // CustomFrames returns non-standard, user-defined frames as a map from // descriptions (e.g. "PERFORMER", "MusicBrainz Album Id", etc.) to // values. CustomFrames() map[string]string // TagSize returns the total size of the tag's header and frames, // i.e. the position at which audio data starts. TagSize() uint32 }
GenericTag is implemented by all the tag types in this project. It gives an incomplete view of the information in each tag type, but is good enough for most purposes.
func Decode ¶
func Decode(r io.ReaderAt, size int64) (GenericTag, error)
Decode reads r and determines which tag format the data is in, if any, and calls the decoding function for that format. size indicates the total number of bytes accessible through r.
Example ¶
f, err := os.Open("testdata/test24.mp3") if err != nil { panic(err) } fi, err := f.Stat() if err != nil { panic(err) } tag, err := Decode(f, fi.Size()) if err != nil { panic(err) } fmt.Println("Title:", tag.Title()) fmt.Println("Artist:", tag.Artist()) fmt.Println("Album:", tag.Album()) fmt.Println("Genre:", tag.Genre()) fmt.Println("Year:", tag.Year()) fmt.Println("Disc:", tag.Disc()) fmt.Println("Track:", tag.Track()) fmt.Println("Performer:", tag.CustomFrames()["PERFORMER"])
Output: Title: Test Name Artist: Test Artist Album: Test Album Genre: Classical Year: 2008-01-01 00:00:00 +0000 UTC Disc: 3 Track: 7 Performer: Somebody
Click to show internal directories.
Click to hide internal directories.