Search code examples
c#taglib-sharpid3v2

TagLib-Sharp not editing comment property


I've been trying to edit some of the properties of a .mp3 using TagLib-Sharp (id3v2). But for some reason Tag.Comment doesn't seem to make any changes on the comment property. The other tags are working flawlessly. My aim is to store a link in one of the properties, as to be able to access it through the Windows Explorer.

Relevant part of the code:

var file = TagLib.File.Create(myFile.FullName);
TagLib.Id3v2.Tag tag = (TagLib.Id3v2.Tag)file.GetTag(TagTypes.Id3v2);

tag.Title = songname;
tag.Performers = artists;
tag.Comment = link;

file.Save();

I've looked all over the place and couldn't find anyone having the same problem. I've been left quite clueless. Does anyone know how I could solve this?


Solution

  • Thanks so much to @PeterCo!

    Apparently the comment property is language specific and that's why it wasn't showing up in the Windows Explorer.

    This code snippet resolved my issue:

    CultureInfo cultureInfo = CultureInfo.InstalledUICulture;
    string language = cultureInfo.ThreeLetterWindowsLanguageName;
    CommentsFrame frame = CommentsFrame.Get(tag, link, language, true);
    frame.Text = link;