Go
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
cmd update to use new io.Seek consts, require min go1.7 Apr 2, 2018
internal/id3v1_test Move ID3v1 test data under `internal` directory Jul 16, 2016
mbz Simplify MusicBrainz Info type and support more tags. Jun 8, 2015
.editorconfig Add a basic editorconfig file May 1, 2015
.travis.yml update to use new io.Seek consts, require min go1.7 Apr 2, 2018
LICENSE Initial commit Mar 19, 2015
README.md Update README.md Aug 1, 2017
flac.go update to use new io.Seek consts, require min go1.7 Apr 2, 2018
id.go update to use new io.Seek consts, require min go1.7 Apr 2, 2018
id3v1.go update to use new io.Seek consts, require min go1.7 Apr 2, 2018
id3v1_test.go Move ID3v1 test data under `internal` directory Jul 16, 2016
id3v2.go id3v2: remove unused method and merge declaration Apr 1, 2018
id3v2_test.go Support for numeric genres in id3v2 Jul 4, 2015
id3v2frames.go id3v2: tidy up dataSplit and decodeText Apr 1, 2018
id3v2metadata.go id3v2: remove unused method and merge declaration Apr 1, 2018
id3v2metadata_test.go Initial commit Mar 19, 2015
mp4.go update to use new io.Seek consts, require min go1.7 Apr 2, 2018
ogg.go update to use new io.Seek consts, require min go1.7 Apr 2, 2018
sum.go update to use new io.Seek consts, require min go1.7 Apr 2, 2018
tag.go update to use new io.Seek consts, require min go1.7 Apr 2, 2018
util.go Implemented basic FLAC support (no artwork, yet!) Apr 14, 2015
util_test.go Add some basic tests for utils May 2, 2015
vorbis.go vorbis: fix panic on invalid encoding Feb 7, 2018

README.md

MP3/MP4/OGG/FLAC metadata parsing library

Build Status GoDoc

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 an io.ReadSeeker (i.e. an *os.File):

m, err := tag.ReadFrom(f)
if err != 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.
type Metadata interface {
	Format() Format
	FileType() FileType

	Title() string
	Album() string
	Artist() string
	AlbumArtist() string
	Composer() string
	Genre() string
	Year() int

	Track() (int, int) // Number, Total
	Disc() (int, int) // Number, Total

	Picture() *Picture // Artwork
	Lyrics() string

	Raw() map[string]interface{} // NB: raw tag names are not consistent across formats.
}

Audio Data Checksum (SHA1)

This package also provides a metadata-invariant checksum for audio files: only the audio data is used to construct the checksum.

http://godoc.org/github.com/dhowden/tag#Sum

Tools

There are simple command-line tools which demonstrate basic tag extraction and summing:

$ go get github.com/dhowden/tag/...
$ cd $GOPATH/bin
$ ./tag 11\ High\ Hopes.m4a
Metadata Format: MP4
Title: High Hopes
Album: The Division Bell
Artist: Pink Floyd
Composer: Abbey Road Recording Studios/David Gilmour/Polly Samson
Year: 1994
Track: 11 of 11
Disc: 1 of 1
Picture: Picture{Ext: jpeg, MIMEType: image/jpeg, Type: , Description: , Data.Size: 606109}

$ ./sum 11\ High\ Hopes.m4a
2ae208c5f00a1f21f5fac9b7f6e0b8e52c06da29