ID3 Tag Parsing

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.

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

The UI is pretty lame, but it works…