Taglib sharp saving ONLY ID3v2

℡╲_俬逩灬. 提交于 2019-12-11 07:25:13

问题


I'm new using TagLib sharp. I'm trying to save ONLY an specific version of the tag inside the file. Everytime I save the tag both ID3v1 and ID3v2 get created. Is there a way to stop this from happening? Can I choose which one I want to save. The save function doesn't take any arguments, so any ideas?


回答1:


These tags are added for convenience when the File object is created. The correct way to remove newly created tags is to perform the following command before calling Save:

file.RemoveTags (file.TagTypes & ~file.TagTypesOnDisk);

Source




回答2:


Thank you Brian.
The C# "& ~" syntax is not that obvious for VB.NET users:

file.RemoveTags(file.TagTypes And Not file.TagTypesOnDisk)

@user1098787:
If you want to write a specific id3v2 version, you can use this commands

TagLib.Id3v2.Tag.DefaultVersion = 3
TagLib.Id3v2.Tag.ForceDefaultVersion = True

Possible values for DefaultVersion are 2 (id3v2.2), 3 (id3v2.3) or 4 (id3v2.4)



来源:https://stackoverflow.com/questions/8513182/taglib-sharp-saving-only-id3v2

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