Unable to use .WriteTag Method

Jan 5, 2013 at 9:02 PM

This project looks promising, but I'm afraid it's looking "abandoned", too.  I hope not.

At any rate, I'm trying to accomplish a fairly simple task - just writing lyrics to MP3s.  I've checked the source code of the "Art Embedder" project (mp3artembedder.codeplex.com), and as far as I can tell, I'm making the right calls, but my call to .WriteTag() raises the exception "This method or operation is not implemented."

I'm having the same result with both the 0.3 and 0.4 versions of the library... if anyone can point out my error, I'd be grateful.

My code follows:

Id3.Mp3File mp3 = new Id3.Mp3File("g:\\x.mp3", Id3.Mp3Permissions.ReadWrite); 
Id3.Id3Tag tag = mp3.GetTag(2,3); 
Id3.Frames.LyricsFrame lyricFrame = new Id3.Frames.LyricsFrame (); 
lyricFrame.Lyrics ="Testing"; 
tag.Lyrics.Clear();
tag.Lyrics.Add(lyricFrame);
mp3.WriteTag(tag, 2, 3, Id3.WriteConflictAction.Replace);

Apr 24, 2013 at 11:47 AM
Edited Apr 24, 2013 at 11:49 AM
I think the version needs to 1,0 instead of 2,3 in your code. Any specific reason for using versions major=2,minor=3?
Following code worked for me
        var musicFiles = Directory.GetFiles(@"E:\Gazals", "*.mp3");
        foreach (var musicFile in musicFiles)
        {

            using (var fileStream = new FileStream(musicFile, FileMode.OpenOrCreate, FileAccess.ReadWrite))
            {
                using (var mp3Stream = new Mp3Stream(fileStream, Mp3Permissions.ReadWrite))
                {
                    mp3Stream.DeleteAllTags();
                    var id3Tag = new Id3Tag();
                    var fileName = new FileInfo(musicFile).Name;
                    fileName = fileName.Substring(0, fileName.Length - 4);
                    id3Tag.Title.Value = fileName;
                    mp3Stream.WriteTag(id3Tag,1,0,WriteConflictAction.NoAction);
                }
                fileStream.Close();
            }
        }
Apr 25, 2013 at 3:12 AM
Edited Apr 25, 2013 at 3:20 AM
I guess I was mistakenly using the ID3 tag version.

When I didn't get an answer after a few days, I switched to "UltraID3Lib", and managed to do what I needed to.

Thanks for your help, though!

EDIT:

I haven't gone back to look at my old code, but are you writing that to a ID3v1 tag? I've removed all of those from my MP3 collection, and I'm exclusively using 2.3 tags now.

My recollection of tag details is a bit hazy at this point, but I don't think that ID3v1 supported lyrics(?)