0

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?

hudriwudi
  • 21
  • 5
  • If you debug your code on the line `file.Save();` do you see the link-value in `tag.Comment`? – PeterCo Sep 09 '21 at 06:36
  • @PeterCo Yes, it can be seen during debugging. After `file.Save();` has been executed, the title & performers can been seen through the Windows Explorer, but the comment field is left empty.I've tried manually editing the comment property and then reading it in in debugging, which worked flawlessly. – hudriwudi Sep 09 '21 at 08:51
  • Okay, so I've tried reading the previously edited file, and apparently the link was stored in the comment tag. But I'm still baffled as to why it isn't showing in the Windows Explorer. – hudriwudi Sep 09 '21 at 09:07
  • You can try to add the "language code" to your comment (must be the same as your current windows language code), something as you can find in `TagLib.Id3v2.CommentsFrame("COMM", "eng", TagLib.StringType.UTF16)` – PeterCo Sep 09 '21 at 10:24

1 Answers1

2

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;
hudriwudi
  • 21
  • 5