Taglib sharp not editing rating

為{幸葍}努か 提交于 2019-12-20 05:37:27

问题


I have encountered a very strange problem while using Taglib sharp. I am changes the rating of video file by using code shown below.

        TagLib.File file = TagLib.File.Create(FULLFILEPATH);
        TagLib.Tag Tag = file.GetTag(TagTypes.Id3v2);
        TagLib.Id3v2.PopularimeterFrame frame = TagLib.Id3v2.PopularimeterFrame.Get((TagLib.Id3v2.Tag)Tag, "WindowsUser", true);
        frame.Rating = 255;
        file.Save();

After saving file when i open the detail tab of video file from properties, rating seems not to be change. But when i again read that file programmatically in c# and check its rating value, it is 255. Why this happening and why rating value is not updating ?


回答1:


Looking at the answer to Check music file rating with VB.NET + WinForms, the likely cause is that your tags may be getting saved as iD3v2.4 and Windows only supports iD3v2.3.

You can force TagLib# to save your tags as iD3v2.3 with the following code:

TagLib.Id3v2.Tag.DefaultVersion = 3;
TagLib.Id3v2.Tag.ForceDefaultVersion = true;


来源:https://stackoverflow.com/questions/18438523/taglib-sharp-not-editing-rating

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!