Skip to content

Instantly share code, notes, and snippets.

@ThuCommix
Created March 19, 2014 20:17
Show Gist options
  • Save ThuCommix/9650280 to your computer and use it in GitHub Desktop.
Save ThuCommix/9650280 to your computer and use it in GitHub Desktop.
//open a new ID3Stream to the specific file
var id3Stream = new ID3Stream(path, System.IO.FileMode.Open, System.IO.FileAccess.ReadWrite);
//read the ID3Tag through ID3 class (v1 example)
var result = (ID3V1Result)ID3.ReadID3Tag(new ID3V1Processor(id3Stream));
Console.WriteLine(result.Title);
Console.WriteLine(result.Artist);
Console.WriteLine(result.Album);
Console.WriteLine(result.Year);
Console.WriteLine(result.Comment);
Console.WriteLine(result.Genre);
//write a new ID3 tag (v1 example)
var id3V1Tag = new ID3V1TagCollection();
id3V1Tag.Title = "Through Darkness";
id3V1Tag.Artist = "Black Snow";
id3V1Tag.Album = "Rhythm of the life";
id3V1Tag.Year = "2001";
id3V1Tag.Comment = "Favorite";
id3V1Tag.Genre = Genre.ClassicRock;
ID3.WriteID3Tag(new ID3V1Processor(id3Stream), id3V1Tag);
//finally close the stream.
id3Stream.Close();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment