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.
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
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