I'm trying to read, and later hopefully write, the rating value on an MP3 file. I'm using the TagLibSharp library and everything I've found so far indicates that this should
work but it doesn't seem to. Here's the code I'm currently using:
TagLib.Id3v2.Tag.DefaultVersion = 3;
TagLib.Id3v2.Tag.ForceDefaultVersion = true;
TagLib.File mp3File =TagLib.File.Create(@"C:\Users\Russ\Downloads\Precious - copy.mp3");
TagLib.Tag tag = mp3File.GetTag(TagLib.TagTypes.Id3v2);
TagLib.Id3v2.PopularimeterFrame frame = TagLib.Id3v2.PopularimeterFrame.Get((TagLib.Id3v2.Tag)tag, "Windows Media Player 9 Series", true);
// at this point, frame.Rating is always 0. Why?;
Here is a screenshot of the properties window of the MP3 file showing that the rating currently is set at 4 stars.
I'd like to accomplish 2 goals.
1. I'd like to be able to read the rating value correctly. I know frames can have different values depending on the user. I'm specifically looking for the one that is displayed here by the Windows system properties.
2. Once I have the correct frame, I want to be able to write a different value back to the file. Say, go from 4 to 5 stars.
Neither of these options are working right now because as you can see by the comment in the code above, the Rating value for the frame is always zero. What am I missing?