在 .Net 中使用 Taglib-sharp 2.0.4.0 编写 ArtWork 时遇到问题
我在 MP3 文件中写入图稿时遇到问题。 我可以使用 Taglib-sharp 读取并显示 MP3 文件内的所有插图,但是当需要在 MP3 标签中插入超过 1 张图片(例如:封面和封底)时,我遇到了问题.如果这只是一件艺术品...我可以做到 有人可以给我扔骨头,并告诉我该怎么做吗? (vb.net 会很棒,但 C# 也能做到这一点)。
又一个请求...并删除 mp3 标签内的图像?有人可以给我一个关于如何做到这一点的例子吗?
感谢您的帮助
I'm having trouble with writing artwork in an MP3 File.
I'm able to read and display all the artwork inside the MP3 file, using Taglib-sharp, but when it comes to insert more than 1 Picture (ex:FrontCover and BackCover) in the MP3 tag, i'm having problems with that.If it's just one Artwork... i can do it
Can someone please throw me bone, and show me how to do it?? (vb.net would be great but C# also do the trick).
One more request... and deleting the image inside the mp3 tag?? Can someone please give me an example on how to do it also.
Thanks for your help
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我遇到了与 Bobby Bhamra 相同的问题。我发现 iTunes 讨厌 UTF-16,这就是问题所在。
所以本质上整个事情都在
pic.TextEncoding
行中。另外,我通过 .NET 常量分配了 Mime 类型。因此,不需要
TagLib.PictureType.Other
或使用描述的解决方法。我的解决方案的唯一缺点是它仅适用于 MP3 文件。I came across the same problem as Bobby Bhamra. I found that iTunes hates UTF-16 and that's what's the problem there.
So essentially the whole thing is in the
pic.TextEncoding
line. Additionally i assigned the Mime Type through the .NET constant.As a result there is no need for
TagLib.PictureType.Other
or the workaround using the Description. The only drawback on my solution is that it will only work correctly for MP3 files.您如何插入和删除图像?你能发布一些代码吗?
所有标签都使用 IPicture 接口以及 Tag.Pictures getter 和 setter 来工作。修改 Tag.Pictures 数组的内容不会对文件产生任何影响,因此修改现有列表涉及获取当前值、对其进行操作,然后将其设置回来。只需设置或清除图片就更容易。
您可以使用以下方法将文件设置为具有单个图像:
您可以使用以下方法从标签中删除所有图像:
操作或更复杂,但遵循相同的思路。如果 Tag.Pictures 是 IEnumerable 而不是数组,那就更好了,但已经完成了。
下面是一个从命令行参数设置图像的示例程序: https: //github.com/mono/taglib-sharp/blob/master/examples/SetPictures.cs
How are you inserting and removing images? Can you post some code?
All tags work using the IPicture interface and the Tag.Pictures getter and setter. Modifying the contents of the Tag.Pictures array will have no effect on the file so modifying the existing list involves getting the current value, maniplating it, and then setting it back. Simply setting or clearing the picture is easier.
You can set the file to have a single image with:
You can remove all images from a tag with the following:
Manipulation or more complex but follows the same lines of thinking. It would have been better if Tag.Pictures was an IEnumerable instead of an array, but what's done is done.
Here's an example program that sets images from the command line arguments: https://github.com/mono/taglib-sharp/blob/master/examples/SetPictures.cs
我在 MP3 标记应用程序中使用以下 taglib-sharp 代码。如果不设置“mime”和“类型”,即使 Windows/WMP 正确显示了该图稿,我也无法在 iTunes 中显示该图稿,随后又在我的 iPod 上显示该图稿。
哈
I'm using the following taglib-sharp code in my MP3 tagging app. Without setting the 'mime' and 'type' I was unable to get the Artwork displaying in ITunes and subsequently on my Ipod even though Windows/WMP was correctly displaying it.
hth
我使用的是 Taglib 版本 2.1.0.0,到目前为止,还没有该版本的文档。
所以我必须来这里搜索所有答案才能找到真正有效的东西
有了这个版本,这就是我想出的...
我使用 Visual Studio 2012 安装了这个版本,并使用了菜单项
工具->库包管理器->包管理器控制台。在“PM>”提示 输入“Install-Package taglib” 这会将 Taglib-Sharp 包添加到您的应用程序中。它实际上是 Power Shell 的命令行实用程序。等待几秒钟,您就可以开始了。
I'm using Taglib version 2.1.0.0 and as of yet, there is no documentation for this version.
So I had to come here to search through all answer to find something that actually worked
with this version and this is what I came up with...
I installed this version using Visual Studio 2012 threw use of the Menu Items
Tools->Library package Manager->Package manager Console. At the "PM>" prompt Type 'Install-Package taglib' This will add the Taglib-Sharp package to your application. It is actually a command line utility to the Power Shell. Wait a few seconds and you are ready to go.