Results 1 to 3 of 3

Thread: MP3 Organizer

  1. #1

    Thread Starter
    Need-a-life Member Mc Brain's Avatar
    Join Date
    Apr 2000
    Location
    Buenos Aires, Argentina
    Posts
    6,808

    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.

  2. #2
    So Unbanned DiGiTaIErRoR's Avatar
    Join Date
    Apr 1999
    Location
    /dev/null
    Posts
    4,111
    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,

  3. #3

    Thread Starter
    Need-a-life Member Mc Brain's Avatar
    Join Date
    Apr 2000
    Location
    Buenos Aires, Argentina
    Posts
    6,808
    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
  •  



Click Here to Expand Forum to Full Width