|
-
Jun 9th, 2001, 11:52 PM
#1
Thread Starter
Need-a-life Member
MP3 Organizer
I'm trying to do an MP3 organizer, so that I can have all my MP3s organized ("ordered by") Artist, Theme, Album, or whatever. I've already "found" how to get all the info from an MP3, but the problem is that it's too slow (extremely slow). The Open statement to read the file is quite slow. Do you know any other way to do this. Here's the code:
Code:
Private Type MP3FrameData
Tag As String
Title As String
Artist As String
Album As String
Year As Integer
Comment As String
Genre As Integer
End Type
Private Sub Form_Load()
Dim MP3Frames As String
Dim MP3Info() As MP3FrameData
ReDim MP3Info(0) As MP3FrameData
MP3s.Path = "C:\Downloaded Files\MP3"
For i = 0 To MP3s.ListCount - 1
DoEvents
ReDim Preserve MP3Info(UBound(MP3Info) + 1) As MP3FrameData
Open MP3s.Path & "\" & MP3s.List(i) For Binary As #1
MP3Frames = Input(LOF(1), 1)
Close #1
MP3Frames = Mid$(MP3Frames, Len(MP3Frames) - 127)
With MP3Info(UBound(MP3Info))
.Tag = GetInfo(MP3Frames, 3)
.Title = GetInfo(MP3Frames, 30)
.Artist = GetInfo(MP3Frames, 30)
.Album = GetInfo(MP3Frames, 30)
.Year = Val(GetInfo(MP3Frames, 4))
.Comment = GetInfo(MP3Frames, 30)
.Genre = Val(GetInfo(MP3Frames, 1))
End With
Next i
End
End Sub
Private Function GetInfo(FullData As String, Lenght As Integer)
GetInfo = Trim$(Trim0(Left$(FullData, Lenght)))
FullData = Mid$(FullData, Lenght + 1)
End Function
Private Function Trim0(Data As String)
Dim i As Integer
For i = Len(Data) To 1 Step -1
If Mid$(Data, i, 1) <> Chr$(0) Then Exit For
Next i
Trim0 = Left$(Data, i)
End Function
Emiliano F. Martín
If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
Encourage the person who helped you to keep doing it, and give him the points he deserves.
MP3 Organizer: Freeware to logically organize all your MP3s.
-
Jun 10th, 2001, 02:12 AM
#2
So Unbanned
You can use API to open your files:
Public Const OFS_MAXPATHNAME = 128
Public Type OFSTRUCT
cBytes As Byte
fFixedDisk As Byte
nErrCode As Integer
Reserved1 As Integer
Reserved2 As Integer
szPathName(OFS_MAXPATHNAME) As Byte
End Type
Public Declare Function OpenFile Lib "kernel32" Alias "OpenFile" (ByVal lpFileName As String, lpReOpenBuff As OFSTRUCT, ByVal wStyle As Long) As Long
May the luck guide you,
-
Jun 10th, 2001, 12:31 PM
#3
Thread Starter
Need-a-life Member
Could you give me a little more luck? I can't understand how to get all the file's contents.
Emiliano F. Martín
If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
Encourage the person who helped you to keep doing it, and give him the points he deserves.
MP3 Organizer: Freeware to logically organize all your MP3s.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|