Edit MP3 ID3 Tags in C#?
-
Anyone know a good place to find a DLL/Project that I can import into my Solution that allows me to edit an ID3 tag in an MP3? Currently out there the pickings are slim for anything that updates version 2 tags. I want something simple that I can reference like this: using ID3Edit; private void Get() { ID3Tag id3Tag = new ID3Tag(); id3Tag.GetV2andV1Tag("C:\\test.mp3"); txtTitleV2.Text = id3Tag.TitleV2; txtTitleV1.Text = id3Tag.TitleV1; } private void Save() { id3Tag.TitleV2 = txtTitle.Text; id3Tag.UpdateV2Tag("C:\\test.mp3"); } I would be willing to pay $100 or so if someone could create a DLL like this for me within the next few days. I bet many other people out there are willing to pay for it as well. If you know of something that's already created in C# that is as easy to use as my above code, email me right away. I just don't have the time or knowledge to put something like that together. Email me for details if you want the job or if you have a DLL like this: Ethan ethanwa@comcast.net
-
Anyone know a good place to find a DLL/Project that I can import into my Solution that allows me to edit an ID3 tag in an MP3? Currently out there the pickings are slim for anything that updates version 2 tags. I want something simple that I can reference like this: using ID3Edit; private void Get() { ID3Tag id3Tag = new ID3Tag(); id3Tag.GetV2andV1Tag("C:\\test.mp3"); txtTitleV2.Text = id3Tag.TitleV2; txtTitleV1.Text = id3Tag.TitleV1; } private void Save() { id3Tag.TitleV2 = txtTitle.Text; id3Tag.UpdateV2Tag("C:\\test.mp3"); } I would be willing to pay $100 or so if someone could create a DLL like this for me within the next few days. I bet many other people out there are willing to pay for it as well. If you know of something that's already created in C# that is as easy to use as my above code, email me right away. I just don't have the time or knowledge to put something like that together. Email me for details if you want the job or if you have a DLL like this: Ethan ethanwa@comcast.net
I will get you started and then let you finish up, this is really not a difficult task. If you read ID3 made easy[^], they explain the byte layout for the ID3 tag within a file. If you have further questions please feel free to post here. The following should get the ID3 tag out of your file:
class ID3Tag
{
public string title;
public string artist;
public string album;
public string year;
public string comment;
public string tracknumber;
public string genre;
}private ID3Tag GetTag(string file)
{
string strTag = string.Empty;
ID3Tag tag = new ID3Tag();
ASCIIEncoding encoding = new ASCIIEncoding();
FileStream fs = new FileStream(file, FileMode.Open);
if(fs != null)
{
byte[] block = new byte[128];
fs.Seek(-128, SeekOrigin.End);
fs.Read(block, 0, 128);
fs.Close();strTag = encoding.GetString(block); if(strTag.Substring(0,3) == "TAG") { tag.title = strTag.Substring(3, 30); tag.artist = strTag.Substring(33, 30); tag.album = strTag.Substring(63, 30); tag.year = strTag.Substring(93, 4); tag.comment = strTag.Substring(97, 28); if(strTag\[125\] == 0) { tag.tracknumber = strTag\[126\]; } else { tag.tracknumber = 0; } tag.genre = strTag\[127\]; } } return tag;
}
HTH - Nick Parker
My Blog | My Articles