Reading id3v2 frames with TagLib in Powershell

送分小仙女□ 提交于 2019-12-22 18:18:05

问题


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.


回答1:


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



回答2:


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.



来源:https://stackoverflow.com/questions/5990881/reading-id3v2-frames-with-taglib-in-powershell

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