- Notifications
You must be signed in to change notification settings - Fork79
ID3, MP4 and OGG/FLAC metadata parsing in Go
License
dhowden/tag
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This package provides MP3 (ID3v1,2.{2,3,4}) and MP4 (ACC, M4A, ALAC), OGG and FLAC metadata detection, parsing and artwork extraction.
Detect and parse tag metadata from anio.ReadSeeker
(i.e. an*os.File
):
m,err:=tag.ReadFrom(f)iferr!=nil {log.Fatal(err)}log.Print(m.Format())// The detected format.log.Print(m.Title())// The title of the track (see Metadata interface for more details).
Parsed metadata is exported via a single interface (giving a consistent API for all supported metadata formats).
// Metadata is an interface which is used to describe metadata retrieved by this package.typeMetadatainterface {Format()FormatFileType()FileTypeTitle()stringAlbum()stringArtist()stringAlbumArtist()stringComposer()stringGenre()stringYear()intTrack() (int,int)// Number, TotalDisc() (int,int)// Number, TotalPicture()*Picture// ArtworkLyrics()stringComment()stringRaw()map[string]interface{}// NB: raw tag names are not consistent across formats.}
This package also provides a metadata-invariant checksum for audio files: only the audio data is used toconstruct the checksum.
https://pkg.go.dev/github.com/dhowden/tag#Sum
There are simple command-line tools which demonstrate basic tag extraction and summing:
$go install github.com/dhowden/tag/cmd/tag@latest$cd$GOPATH/bin$./tag 11\High\Hopes.m4aMetadata Format: MP4Title: High HopesAlbum: The Division BellArtist: Pink FloydComposer: Abbey Road Recording Studios/David Gilmour/Polly SamsonYear: 1994Track: 11 of 11Disc: 1 of 1Picture: Picture{Ext: jpeg, MIMEType: image/jpeg, Type: , Description: , Data.Size: 606109}$./sum 11\High\Hopes.m4a2ae208c5f00a1f21f5fac9b7f6e0b8e52c06da29
About
ID3, MP4 and OGG/FLAC metadata parsing in Go
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Packages0
Uh oh!
There was an error while loading.Please reload this page.