#162940 - 2006-06-06 12:42 PM
Read ID3 tag information
|
Leon
Fresh Scripter
Registered: 2005-11-16
Posts: 5
|
Right I'm trying to knock up a script that can read the information held within the ID3 tags on an mp3 file using KIX.
I'm primarily concerned with reading the information but long term the ability to change the tag would be useful.
I've not been able to find any useful information on this so far so any help will be much appreciated.
|
Top
|
|
|
|
#162944 - 2006-06-07 11:46 AM
Re: Read ID3 tag information
|
Arend_
MM club member
Registered: 2005-01-17
Posts: 1894
Loc: Hilversum, The Netherlands
|
Here's a script I've been toying around with, haven't gotten all the properties yet and basically abandoned the project since it's dependable on cbbdcontrol.dll which gets installed with all soundblaster enabled audio cards. I'll post my Windows version later if I find it. It's based upon the same VBS script as Mart displayed.
just use ListID3Tags("C:\Folderhere") Code:
Function ListID3Tags($sFolder) Dim $FSO $FSO = CreateObject("Scripting.FileSystemObject") ListID3TagsFS($FSO.GetFolder($sFolder)) EndFunction
Function ListID3TagsFS($Root) Dim $SubFolder, $mp3 For Each $mp3 In $Root.Files If LCase(Right($mp3.Name, 3)) == "mp3" ListID3TagsFile($mp3) EndIf Next For Each $SubFolder In $Root.SubFolders ListID3TagsFS($SubFolder) Next EndFunction
Function ListID3TagsFile($mp3) Dim $id3 $id3 = CreateObject("CDDBControl.CddbID3Tag") $id3.LoadFromFile($mp3.Path,1) ? "File Name: " $mp3.Path ? "Artist: "$id3.LeadArtist ? "Title: " $id3.Title ? "Album: " $id3.Album ? "Comment: " $id3.Comments + @CRLF EndFunction
Side Note: The cddbcontrol will enable you to change the file tag information as well, the windows version will not.
Edited by apronk (2006-06-07 11:50 AM)
|
Top
|
|
|
|
#162945 - 2006-06-07 08:50 PM
Re: Read ID3 tag information
|
Arend_
MM club member
Registered: 2005-01-17
Posts: 1894
Loc: Hilversum, The Netherlands
|
And here the windows version as promised, basically using the 'GetDetailsOf' property. Unfortunately as far as I know windows won't let you change any info.
Code:
Function fnGetDetailsOf() dim $objShell dim $objFolder $objShell = CreateObject("Shell.Application") $objFolder = $objShell.NameSpace("D:\MP3") If $objFolder <> "" dim $objFolderItem $objFolderItem = $objFolder.ParseName("Guns N' Roses - Madagascar.mp3") If $objFolderItem <> "" dim $objInfo ? "File Name: " $objFolder.GetDetailsOf($objFolderItem, 0) ? "File Size: " $objFolder.GetDetailsOf($objFolderItem, 1) ? "File Type: " $objFolder.GetDetailsOf($objFolderItem, 2) ? "File Date Modified: " $objFolder.GetDetailsOf($objFolderItem, 3) ? "File Date Created: " $objFolder.GetDetailsOf($objFolderItem, 4) ? "File Date Accessed: " $objFolder.GetDetailsOf($objFolderItem, 5) ? "File Attributes: " $objFolder.GetDetailsOf($objFolderItem, 6) ? "File Status: " $objFolder.GetDetailsOf($objFolderItem, 7) ? "File Owner: " $objFolder.GetDetailsOf($objFolderItem, 8) ? "File Author: "$objFolder.GetDetailsOf($objFolderItem, 9) ? "File Title: " $objFolder.GetDetailsOf($objFolderItem, 10) ? "File Subject: " $objFolder.GetDetailsOf($objFolderItem, 11) ? "File Category: " $objFolder.GetDetailsOf($objFolderItem, 12) ? "File Pages: " $objFolder.GetDetailsOf($objFolderItem, 13) ? "File Comments: " $objFolder.GetDetailsOf($objFolderItem, 14) ? "File Copyright: " $objFolder.GetDetailsOf($objFolderItem, 15) ? "File Artist: " $objFolder.GetDetailsOf($objFolderItem, 16) ? "File Album Title: " $objFolder.GetDetailsOf($objFolderItem, 17) ? "File Year: " $objFolder.GetDetailsOf($objFolderItem, 18) ? "File Track Number: " $objFolder.GetDetailsOf($objFolderItem, 19) ? "File Genre: " $objFolder.GetDetailsOf($objFolderItem, 20) ? "File Duration: " $objFolder.GetDetailsOf($objFolderItem, 21) ? "File Bit Rate: " $objFolder.GetDetailsOf($objFolderItem, 22) ? "File Protected: " $objFolder.GetDetailsOf($objFolderItem, 23) ? "File Camera Model: " $objFolder.GetDetailsOf($objFolderItem, 24) ? "File Date Picture Taken: " $objFolder.GetDetailsOf($objFolderItem, 25) ? "File Dimensions: " $objFolder.GetDetailsOf($objFolderItem, 26) ? "File Not Used: " $objFolder.GetDetailsOf($objFolderItem, 27) ? "File Not Used: " $objFolder.GetDetailsOf($objFolderItem, 28) ? "File Not Used: " $objFolder.GetDetailsOf($objFolderItem, 29) ? "File Company: " $objFolder.GetDetailsOf($objFolderItem, 30) ? "File Description: " $objFolder.GetDetailsOf($objFolderItem, 31) ? "File File Version: " $objFolder.GetDetailsOf($objFolderItem, 32) ? "File Product Name: " $objFolder.GetDetailsOf($objFolderItem, 33) ? "File Product Version: " $objFolder.GetDetailsOf($objFolderItem, 34) EndIf $objFolderItem = "" EndIf $objFolder = "" $objShell = "" EndFunction
Just call for: fnGetDetailsOf() You'd have to edit the path and mp3 in the function for now, like I said it's WIP so I haven't optimised it yet, was just testing the GetDetailsOf stuff, haven't bothered to really continue it yet.
|
Top
|
|
|
|
#162946 - 2006-06-17 10:18 AM
Re: Read ID3 tag information
|
Leon
Fresh Scripter
Registered: 2005-11-16
Posts: 5
|
Thats spot on dude! Excellent... Cheers for the input everyone. I've managed to do pretty much what I need to for the moment. I'm gonna stick to just reading the info for now.
Thanks
|
Top
|
|
|
|
#186762 - 2008-04-06 11:18 PM
Re: Read ID3 tag information
[Re: Leon]
|
dennywong
Just in Town
Registered: 2008-04-06
Posts: 3
|
I'd like to know then, is there a way for me to attach a jpg to the mp3? So say I got this "BryanAdam.mp3" and I have bryanadam.jpg on my C:\ drive, what CDDBControl.DLL method do I use to link (or embed) the image to the mp3 file? Thanks Denny
|
Top
|
|
|
|
#186769 - 2008-04-07 05:40 AM
Re: Read ID3 tag information
[Re: dennywong]
|
NTDOC
Administrator
Registered: 2000-07-28
Posts: 11623
Loc: CA
|
|
Top
|
|
|
|
#186777 - 2008-04-07 06:16 PM
Re: Read ID3 tag information
[Re: NTDOC]
|
dennywong
Just in Town
Registered: 2008-04-06
Posts: 3
|
Hi NTDOC, thanks for your reply... I'm not sure if I understand your message at all, is it a reply to my question? I want to know how to embed a jpg into mp3 with the CDDBControl.dll, and I was hoping there would be a function or method to do that, even though I couldn't find any.....
Thanks again
|
Top
|
|
|
|
#186977 - 2008-04-16 07:53 PM
Re: Read ID3 tag information
[Re: Arend_]
|
dennywong
Just in Town
Registered: 2008-04-06
Posts: 3
|
Thanks guy... But I just want to make sure I'm not crazy: there are in fact ways that you can attach and embed an jpg into an mp3 file, maybe just not with DLL, right? (That's why the image will show up in the Media Player when I play that mp3 file)
|
Top
|
|
|
|
Moderator: Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart
|
0 registered
and 515 anonymous users online.
|
|
|