问题描述
我已经在使用标签库尖锐遇到了一个很奇怪的问题。我用下面所示的代码转换视频文件的评级。
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();
保存文件,当我打开从性能的视频文件的细节选项卡后,评价似乎并没有被改变。但是,当我再次读取该文件C#编程,并检查其评级的价值,这是为什么255这样的情况,为什么额定值没有更新?
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 ?
推荐答案
综观答案的的,可能的原因是,您的代码可能会得到保存为iD3v2.4和Windows只支持ID3V2。 3
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.
您可以强制的TagLib#保存您的标签,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;
这篇关于标签库不锐利编辑评级的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!