在 Powershell 中使用 TagLib 读取 id3v2 帧

发布于 2024-11-07 04:40:40 字数 215 浏览 3 评论 0原文

我正在尝试使用 TagLib# 库和 Powershell 读取文件的 id3v2 标签信息。 读取标准标签属性不是问题(艺术家、标题等),但我很难弄清楚如何读取 ID3v2 帧(特别是注释)。

谁能提供一个简单的例子来说明如何实现这一目标? 这方面的文档似乎很少。

I'm trying to read a file's id3v2 tag information using the TagLib# library with Powershell.
Reading the standard tag properties is not a problem (artist, title etc.), but I'm having difficulty figuring out how to read the ID3v2 frames (specifically the COMMENT).

Can anyone provide a simple example as to how to accomplish this?
Documentation on this is scarce it seems.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

┼── 2024-11-14 04:40:40

这似乎对我有用 - 您能澄清一下您的问题吗?

# load the TagLib# assembly into PowerShell
[Reflection.Assembly]::LoadFrom("C:\taglib-sharp.dll")

# grab the MP3 file with TagLib
$file = [TagLib.File]::Create("C:\overture.mp3")

# read the COMMENT tag field
$file.Tag.Comment

至少对我来说,这会输出以下行:

Amazon.com Song ID: 123456789

This seems to work for me - could you please clarify your question with what isn't working?

# load the TagLib# assembly into PowerShell
[Reflection.Assembly]::LoadFrom("C:\taglib-sharp.dll")

# grab the MP3 file with TagLib
$file = [TagLib.File]::Create("C:\overture.mp3")

# read the COMMENT tag field
$file.Tag.Comment

For me at least, this output the following line:

Amazon.com Song ID: 123456789
贪恋 2024-11-14 04:40:40

想通了。

这就是我想要实现的目标:

# load the TagLib# assembly into PowerShell
[Reflection.Assembly]::LoadFrom("C:\taglib-sharp.dll")

$media = [TagLib.MPEG.File]::Create("C:\1812 Overture.mp3")
[TagLib.Id3v2.Tag] $currId3v2 = $media.GetTag([TagLib.TagTypes]::Id3v2)

$commentFrames = $currId3v2.GetFrames("COMM")
...

抱歉,如果我的描述不够充分。

并感谢您愿意提供帮助。

Figured it out.

This is what I was trying to accomplish:

# load the TagLib# assembly into PowerShell
[Reflection.Assembly]::LoadFrom("C:\taglib-sharp.dll")

$media = [TagLib.MPEG.File]::Create("C:\1812 Overture.mp3")
[TagLib.Id3v2.Tag] $currId3v2 = $media.GetTag([TagLib.TagTypes]::Id3v2)

$commentFrames = $currId3v2.GetFrames("COMM")
...

Sorry if I was not descriptive enough.

And thanks for the willingness to help.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文