Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

ID3, MP4 and OGG/FLAC metadata parsing in Go

License

NotificationsYou must be signed in to change notification settings

dhowden/tag

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 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.}

Audio Data Checksum (SHA1)

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

Tools

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

[8]ページ先頭

©2009-2025 Movatter.jp