1
具体来说,我想编写Windows Media Player帧,如WM/MediaClassPrimaryID
,WM/MediaClassSecondaryID
和WM/WMCollectionGroupID
帧。如何使用TagLib-Sharp编写自定义(PRIV)ID3帧?
我正在使用PowerShell,但C#也不错。
具体来说,我想编写Windows Media Player帧,如WM/MediaClassPrimaryID
,WM/MediaClassSecondaryID
和WM/WMCollectionGroupID
帧。如何使用TagLib-Sharp编写自定义(PRIV)ID3帧?
我正在使用PowerShell,但C#也不错。
我有点生疏,但以下应该大部分是正确的。我记得这些标签是UTF-16,但您可能希望获得现有的标签,并尝试使用Unicode编码器解码其值。
// Get or create the ID3v2 tag.
TagLib.Id3v2.Tag id3v2_tag = file.GetTag(TagLib.TagTypes.Id3v2, true);
if(id3v2_tag != null) {
// Get the private frame, create if necessary.
PrivateFrame frame = PrivateFrame.Get(id3v2_tag, "WM/MediaClassPrimaryID", true);
// Set the frame data to your value. I am 90% sure that these are encoded with UTF-16.
frame.PrivateData = System.Text.Encoding.Unicode.GetBytes(value);
}