Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I get file attributes of MP3 files (AlbumTitle, Artist, Genre,

Status
Not open for further replies.

bobski1

Programmer
Aug 17, 2006
2
How can I get file attributes of MP3 files (AlbumTitle, Artist, Genre, etc)?

I am using the following code and only get the main file attributes such as: name, size, Type, date created,
date last accessed, and date last modified. The music attributes print as blank. I did turn on these music attributes in the directory view details and did see that there was information in these attribute fields. Can you please help with some sample code.


Sub Main

On Error GoTo Err_1

'***** Read files from selected folder (Directory) *****
Set fs = CreateObject("Scripting.FileSystemObject")

Set dirfolder = fs.GetFolder("E:\_Music\mp3\Enigma\The Cross Of Changes\")

'***** Read files *****
For Each fl In dirfolder.Files

aName = fl.name
aSize = Format(Int(fl.Size / 1024) + 1, "###,###,### KB")
aType = fl.type
aDC = Format(fl.DateCreated, "mm/dd/yyyy")
aDLA = Format(fl.DateLastAccessed, "mm/dd/yyyy")
aDLM = Format(fl.DateLastModified, "mm/dd/yyyy")
aTitle = fl.title
aArtist = fl.Artist
aAlbumTitle = fl.AlbumTitle
aGenre = fl.Genre

MsgBox ":" & aName & ":" & vbCrLf _
& ":" & aSize & ":" & vbCrLf _
& ":" & aType & ":" & vbCrLf _
& ":" & aDC & ":" & vbCrLf _
& ":" & aDLA & ":" & vbCrLf _
& ":" & aDLM & ":" & vbCrLf _
& ":" & aTitle & ":" & vbCrLf _
& ":" & aArtist & ":" & vbCrLf _
& ":" & aAlbumTitle & ":" & vbCrLf _
& ":" & aGenre & ":" & vbCrLf

Next fl

'On Error GoTo Err_1
Exit_1:
Exit Sub

Err_1:
MsgBox "********** In Subroutine Main ********** " & vbCrLf & vbCrLf & Error$
Resume Exit_1

End Sub
 
not sure if this will help or not but found this on Google.




ID3v1 Tags
The ID3v1 tag is found at the end of an MP3 file and has a fixed number of fields and size. The structure of the tag is as follows:

Private Type MP3ID3V1Tag
Tag As String * 3 '-- 03 = "TAG"
Title As String * 30 '-- 33
Artist As String * 30 '-- 63
Album As String * 30 '-- 93
Year As String * 4 '-- 97
Comment As String * 30 '-- 127
Genre As Byte '-- 128
End Type
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top