ID3 Tag Parsing

March 25, 2009

I’ve been working on a project to read and update ID3 tags on my music collection. An ID3 tag is the meta data embedded in mp3 files that contains artist and other information. My initial goal is to batch update the “genre” field in my mp3 files. I’ve written a simple .Net forms application to do this. I found a really good library created by Novell called TagLib Sharp. The library makes it super easy to read and write ID3 tags.

<br /> TagLib.File tagFile = TagLib.File.Create(filePath);<br /> Tag tagId3v2 = tagFile.GetTag(TagTypes.Id3v2);<br /> if (tagId3v2 != null) tagId3v2.Genres = genreArray;<br /> Tag tagId3v1 = tagFile.GetTag(TagTypes.Id3v1);<br /> if (tagId3v1 != null) tagId3v1.Genres = genreArray;<br /> tagFile.Save();<br />

The UI is pretty lame, but it works…