Sign in to follow this  
Followers 0
Marlo

Music Files

3 posts in this topic

Hey guys. I'm in the process of making a new AutoIt App but i've ran into a problem.

You see in my app i plan to use .mp3 files and most mp3 files have more than just a file name.

If you right click a music file, click properties then hit the "Summary" tab then click "Advanced" You will see artist information.

Example:

Posted Image

Now how would i go about getting this information into an autoit Variable/Array? i cant see anything in the help files =(

Any help at all is apreciated.

Regards


Click here for the best AutoIt help possible.Currently Working on: Autoit RAT

Share this post


Link to post
Share on other sites



try these :)

Func Songinfo($file) ;Finds Title|Author|Album for any media file
    Dim $return[5]
    $return[1] = _GetExtProperty($file, 10);name
    $return[2] = _GetExtProperty($file, 16);atrist
    $return[3] = _GetExtProperty($file, 17);album
    
    If $return[1] = "" Or $return[1] = "Unknown" Then $return[1] = "No_name_" & Floor(Random(0, 1000))
    If $return[2] = "" Or $return[2] = "Unknown" Then $return[2] = "Unknown_Artist"
    If $return[3] = "" Or $return[3] = "Unknown" Then $return[3] = "Unknown_Album"
    
    Return $return
EndFunc   ;==>Songinfo

Func _GetExtProperty($sPath, $iProp)
    Local $iExist, $sFile, $sDir, $oShellApp, $oDir, $oFile, $aProperty, $sProperty
    $iExist = FileExists($sPath)
    If $iExist = 0 Then
        SetError(1)
        Return 0
    Else
        $sFile = StringTrimLeft($sPath, StringInStr($sPath, "\", 0, -1))
        $sDir = StringTrimRight($sPath, (StringLen($sPath) - StringInStr($sPath, "\", 0, -1)))
        $oShellApp = ObjCreate("shell.application")
        $oDir = $oShellApp.NameSpace($sDir)
        $oFile = $oDir.Parsename($sFile)
        If $iProp = -1 Then
            Local $aProperty[35]
            For $i = 0 To 34
                $aProperty[$i] = $oDir.GetDetailsOf($oFile, $i)
            Next
            Return $aProperty
        Else
            $sProperty = $oDir.GetDetailsOf($oFile, $iProp)
            If $sProperty = "" Then
                Return "Unknown"
            Else
                Return $sProperty
            EndIf
        EndIf
    EndIf
EndFunc   ;==>_GetExtProperty

cheers!


Some Projects:[list][*]ZIP UDF using no external files[*]iPod Music Transfer [*]iTunes UDF - fully integrate iTunes with au3[*]iTunes info (taskbar player hover)[*]Instant Run - run scripts without saving them before :)[*]Get Tube - YouTube Downloader[*]Lyric Finder 2 - Find Lyrics to any of your song[*]DeskBox - A Desktop Extension Tool[/list]indifference will ruin the world, but in the end... WHO CARES :P---------------http://torels.altervista.org

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0