MP3/MP4/FLAC/OGG tag reader and writer for go
This package enables parsing and writing of ID tags for mp3, mp4 (m4a, m4b, m4p), FLAC, and ogg (Vorbis, OPUS) files.
All fields can be accessed via the provided accessor methods. Only supported fields per file type will return non zero data. The exception to this is that ogg files support a passthrough map. By setting kv pairs in the passthrough map, non-standard vorbis comment tags can be written to both ogg Vorbis and ogg OPUS files.
Artist, AlbumArtist, Album, AlbumArt, BPM, ContentType, Comments, Composer, CopyrightMessage, Date, EncodedBy, FileType, Genre, Language, Length, Lyricist, PartOfSet, Publisher, Title, Year
Artist, AlbumArtist, Album, AlbumArt, Comments, Composer, CopyrightMessage, EncodedBy, Genre, Title, Year
Artist, Album, AlbumArt, Date, Genre, Title
Artist, AlbumArtist, Album, AlbumArt, Comment, Composer, Copyright, Date, Genre, Title, Publisher, (extended support for custom fields via passthrough map)
Artist, AlbumArtist, Album, AlbumArt, BPM, ContentType, Comments, Composer, CopyrightMessage, Date, EncodedBy, FileType, Genre, Language, Length, Lyricist, PartOfSet, Publisher, Title, Year
Artist, AlbumArtist, Album, Comments, CopyrightMessage, Composer, Genre, Title, Year (AlbumArt is currently not writeable)
Artist, Album, AlbumArt, Date, Genre, Title
Artist, AlbumArtist, Album, AlbumArt, Comment, Composer, Copyright, Date, Genre, Title, Publisher, (extended support for custom fields via passthrough map)
tag, err := audiometa.OpenTagFromPath("./my-audio-file.mp3")
if err != nil{
panic(err)
}
artist := tag.Artist()
album := tag.Album()
title := tag.Title()
f, err := os.Open("./my-audio-file.mp3")
tag, err := audiometa.Open(f, audiometa.ParseOptions{Format: audiometa.MP3}) //ParseOptions is only required if the file does not have an extension
if err != nil{
panic(err)
}
artist := tag.Artist()
album := tag.Album()
title := tag.Title()
f, err := os.Open("./my-audio-file.mp3")
if err != nil{
panic(err)
}
tag, err := audiometa.Open(f)
if err != nil{
panic(err)
}
tag.SetArtist("Beyonce")
err = tag.Save(f)
if err != nil{
panic(err)
}
f, err := os.Open("./my-audio-file.mp3")
if err != nil{
panic(err)
}
tag, err := audiometa.Open(f)
if err != nil{
panic(err)
}
tag.ClearAllTags()
err = tag.Save(f)
if err != nil{
panic(err)
}