Sign in to follow this  
Followers 0
Lazycat

UDF for retrieve MP3 tags info

27 posts in this topic

I like this script, it's nice.

I also downloaded your script to read JPG EXIF information.

Is it possible to put extra comments in the exif information by scripting?

So i can put my keywords in the JPG EXIF

Share this post


Link to post
Share on other sites

where can i find it now?


[font="Verdana"]In work:[list=1][*]InstallIt[*]New version of SpaceWar[/list] [/font]

Share this post


Link to post
Share on other sites

Check his signature...heh.

Share this post


Link to post
Share on other sites

@LazyCat

the download link is broken


My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.

Share this post


Link to post
Share on other sites

look here: http://www.autoitscript.com/fileman/users/Lazycat/udfs.html


[font="Verdana"]In work:[list=1][*]InstallIt[*]New version of SpaceWar[/list] [/font]

Share this post


Link to post
Share on other sites

thanks


My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.

Share this post


Link to post
Share on other sites

i get these errors when i run the example

C:\Documents and Settings\FrazerMcLean\Desktop\mp3 tag\get_mp3_tag.au3(25,61) : ERROR: syntax error
    Local $ret = DllCall("kernel32.dll","int","CreateFile",_
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Documents and Settings\FrazerMcLean\Desktop\mp3 tag\get_mp3_tag.au3(26,39) : ERROR: syntax error
                        "str",$sFile,_
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Documents and Settings\FrazerMcLean\Desktop\mp3 tag\get_mp3_tag.au3(27,43) : ERROR: syntax error
                        "int",0x80000000,_
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Documents and Settings\FrazerMcLean\Desktop\mp3 tag\get_mp3_tag.au3(28,34) : ERROR: syntax error
                        "int",0,_
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Documents and Settings\FrazerMcLean\Desktop\mp3 tag\get_mp3_tag.au3(29,34) : ERROR: syntax error
                        "ptr",0,_
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Documents and Settings\FrazerMcLean\Desktop\mp3 tag\get_mp3_tag.au3(30,34) : ERROR: syntax error
                        "int",3,_
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Documents and Settings\FrazerMcLean\Desktop\mp3 tag\get_mp3_tag.au3(31,37) : ERROR: syntax error
                        "int",0x80,_
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Documents and Settings\FrazerMcLean\Desktop\mp3 tag\get_mp3_tag.au3(68,66) : ERROR: $hFile already declared as parameter
Local $nTagSize = 1, $nFrameOffset = 10, $nTagInfo, $ret, $hFile 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Documents and Settings\FrazerMcLean\Desktop\mp3 tag\get_mp3_tag.au3(69,31) : ERROR: $hFile already declared as parameter
Local $asInfo[8], $sID, $hFile,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Documents and Settings\FrazerMcLean\Desktop\mp3 tag\get_mp3_tag.au3(82,85) : WARNING: $p: possibly used before declaration.
If _IsBitSet($nTagInfo, 6) Then $nFrameOffset = 10 + _SSIntToInt(DllStructGetData($p,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Documents and Settings\FrazerMcLean\Desktop\mp3 tag\get_mp3_tag.au3(133,1) : ERROR: string break without trailing _
    Local $asGenre = StringSplit("Blues,Classic Rock,Country,Dance,Disco,Funk,Grunge,Hip-Hop,Jazz,Metal,New Age,_
    Oldies,Other,Pop,R&B,Rap,Reggae,Rock,Techno,Industrial,Alternative,Ska,Death Metal,Pranks,_
    Soundtrack,Euro-Techno,Ambient,Trip-Hop,Vocal,Jazz+Funk,Fusion,Trance,Classical,Instrumental,_
    Acid,House,Game,Sound Clip,Gospel,Noise,Alternative Rock,Bass,Soul,Punk,Space,Meditative,_
    Instrumental Pop,Instrumental Rock,Ethnic,Gothic,Darkwave,Techno-Industrial,Electronic,Pop-Folk,_
    Eurodance,Dream,Southern Rock,Comedy,Cult,Gangsta,Top 40,Christian Rap,Pop/Funk,Jungle,Native US,_
    Cabaret,New Wave,Psychadelic,Rave,Showtunes,Trailer,Lo-Fi,Tribal,Acid Punk,Acid Jazz,Polka,Retro,_
    Musical,Rock & Roll,Hard Rock,Folk,Folk-Rock,National Folk,Swing,Fast Fusion,Bebob,Latin,Revival,_
    Celtic,Bluegrass,Avantgarde,Gothic Rock,Progressive Rock,Psychedelic Rock,Symphonic Rock,Slow Rock,_
    Big Band,Chorus,Easy Listening,Acoustic,Humour,Speech,Chanson,Opera,Chamber Music,Sonata,Symphony,_
    Booty Bass,Primus,Porn Groove,Satire,Slow Jam,Club,Tango,Samba,Folklore,Ballad,Power Ballad,Rhytmic Soul,_
    Freestyle,Duet,Punk Rock,Drum Solo,Acapella,Euro-House,Dance Hall,Goa,Drum & Bass,Club-House,Hardcore,_
    Terror,Indie,BritPop,Negerpunk,Polsk Punk,Beat,Christian Gangsta,Heavy Metal,Black Metal,Crossover,_
    Contemporary C,Christian Rock,Merengue,Salsa,Thrash Metal,Anime,JPop,SynthPop"
^
C:\Documents and Settings\FrazerMcLean\Desktop\mp3 tag\get_mp3_tag.au3(175,62) : ERROR: syntax error
    Local $ret  = DllCall("kernel32.dll","int","SetFilePointer",_
    ~~~~~~~~~~  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Documents and Settings\FrazerMcLean\Desktop\mp3 tag\get_mp3_tag.au3(176,20) : ERROR: syntax error
                    "int",$hFile,_
                    ~~~~~~~~~~~~~~^
C:\Documents and Settings\FrazerMcLean\Desktop\mp3 tag\get_mp3_tag.au3(177,22) : ERROR: syntax error
                    "int",$nOffset,_
                    ~~~~~~~~~~~~~~~~^
C:\Documents and Settings\FrazerMcLean\Desktop\mp3 tag\get_mp3_tag.au3(178,15) : ERROR: syntax error
                    "int",0,_
                    ~~~~~~~~~^
C:\Documents and Settings\FrazerMcLean\Desktop\mp3 tag\get_mp3_tag.au3(181,50) : ERROR: syntax error
    $ret    = DllCall("kernel32.dll","int","ReadFile",_
    ~~~~    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Documents and Settings\FrazerMcLean\Desktop\mp3 tag\get_mp3_tag.au3(182,20) : ERROR: syntax error
                    "int",$hFile,_
                    ~~~~~~~~~~~~~~^
C:\Documents and Settings\FrazerMcLean\Desktop\mp3 tag\get_mp3_tag.au3(183,39) : ERROR: syntax error
                    "ptr",DllStructGetPtr($vStruct),_
                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Documents and Settings\FrazerMcLean\Desktop\mp3 tag\get_mp3_tag.au3(184,20) : ERROR: syntax error
                    "int", $nLen,_
                    ~~~~~~~~~~~~~~^
C:\Documents and Settings\FrazerMcLean\Desktop\mp3 tag\get_mp3_tag.au3(185,37) : ERROR: syntax error
                    "ptr",DllStructGetPtr($pRead),_
                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Documents and Settings\FrazerMcLean\Desktop\mp3 tag\get_mp3_tag.au3(82,85) : ERROR: $p: undeclared global variable.
If _IsBitSet($nTagInfo, 6) Then $nFrameOffset = 10 + _SSIntToInt(DllStructGetData($p,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Documents and Settings\FrazerMcLean\Desktop\mp3 tag\get_mp3_tag.au3(63,26) : ERROR: DllStructDelete(): undefined function.
    DllStructDelete($pTag)
~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Documents and Settings\FrazerMcLean\Desktop\mp3 tag\get_mp3_tag_example.au3 - 21 error(s), 1 warning(s)


My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.

Share this post


Link to post
Share on other sites

Just put a space before the "_", that udf was written before that was changed.


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

now i get

C:\Documents and Settings\FrazerMcLean\Desktop\mp3 tag\get_mp3_tag.au3(68,66) : ERROR: $hFile already declared as parameter
Local $nTagSize = 1, $nFrameOffset = 10, $nTagInfo, $ret, $hFile 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Documents and Settings\FrazerMcLean\Desktop\mp3 tag\get_mp3_tag.au3(69,31) : ERROR: $hFile already declared as parameter
Local $asInfo[8], $sID, $hFile,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Documents and Settings\FrazerMcLean\Desktop\mp3 tag\get_mp3_tag.au3(82,85) : WARNING: $p: possibly used before declaration.
If _IsBitSet($nTagInfo, 6) Then $nFrameOffset = 10 + _SSIntToInt(DllStructGetData($p,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Documents and Settings\FrazerMcLean\Desktop\mp3 tag\get_mp3_tag.au3(82,85) : ERROR: $p: undeclared global variable.
If _IsBitSet($nTagInfo, 6) Then $nFrameOffset = 10 + _SSIntToInt(DllStructGetData($p,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Documents and Settings\FrazerMcLean\Desktop\mp3 tag\get_mp3_tag.au3(63,26) : ERROR: DllStructDelete(): undefined function.
    DllStructDelete($pTag)
~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Documents and Settings\FrazerMcLean\Desktop\mp3 tag\get_mp3_tag.au3 - 4 error(s), 1 warning(s)

Edited by RazerM

My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.

Share this post


Link to post
Share on other sites

get_mp3_tag.au3

;===============================================================================
;
; Description:    Retrieve MP3 tag info
; Parameter(s):  File name
; Requirement(s):   Autoit Beta 3.104 (DllStruct, RegExp)
; Return Value(s):  On Success - array with data:
;                      0 - Title
;                      1 - Artist
;                      2 - Album
;                      3 - Year
;                      4 - Comment
;                      5 - Track number
;                      6 - Genre
;                      7 - Length (for V2 only, may be used for determine length for VBR files)
;                  On Failure empty string and sets @ERROR:
;                      1 - Info not found
; Author(s):        YDY (Lazycat)
; Version:        2.0
; Date:          17.06.2005
; Note(s):        None
;
;===============================================================================

Func _MP3GetTag($sFile)
    Local $ret = DllCall("kernel32.dll", "int", "CreateFile", _
            "str", $sFile, _
            "int", 0x80000000, _
            "int", 0, _
            "ptr", 0, _
            "int", 3, _
            "int", 0x80, _
            "ptr", 0)
    
    If @error Or Not $ret[0] Then 
        SetError(1)
        Return ""
    EndIf
    Local $vTag = _MP3GetV2Tag($ret[0])
    If Not IsArray($vTag) Then $vTag = _MP3GetV1Tag($ret[0], FileGetSize($sFile) - 128)
    DllCall("kernel32.dll", "int", "CloseHandle", "int", $ret[0])
    If IsArray($vTag) Then Return $vTag
    SetError(1)
    Return ""
EndFunc

Func _MP3GetV1Tag($hFile, $nTagPos)
    Local $pTag = _FileReadToStruct("char[3];char[30];char[30];char[30];char[4];char[28];byte;byte;byte", $hFile, $nTagPos) 
    If not (_DllStructArrayAsString($pTag, 1, 3) == "TAG") Then Return (""); ID3v1 tag NOT found
    Local $asInfo[8]
    $asInfo[0] = _DllStructArrayAsString($pTag, 2, 30)     ; Title
    $asInfo[1] = _DllStructArrayAsString($pTag, 3, 30)     ; Peformer
    $asInfo[2] = _DllStructArrayAsString($pTag, 4, 30)     ; Album
    $asInfo[3] = _DllStructArrayAsString($pTag, 5, 4)       ; Year
    If DllStructGetData($pTag, 7) = 0 Then                 ; Probably version 1.1
        $asInfo[4] = _DllStructArrayAsString($pTag, 6, 28)   ; Comment
        $asInfo[5] = DllStructGetData($pTag, 8)
    Else
        $asInfo[4] = _DllStructArrayAsString($pTag, 6, 30)   ; Comment
        $asInfo[5] = ""
    EndIf
    $asInfo[6] = _MP3GetGenreByID(DllStructGetData($pTag, 9)); Genre
    $asInfo[7] = ""
    $pTag = ""
    Return ($asInfo)
EndFunc

Func _MP3GetV2Tag($hFile)
    Local $nTagSize = 1, $nFrameOffset = 10, $nTagInfo, $ret, $p
    Local $asInfo[8], $sID, $pFrame, $pHeader, $pTemp, $nFrameSize, $sData
    
    $pHeader = _FileReadToStruct("char[3];short;byte;dword;dword", $hFile, 0)
    If not (StringLeft(DllStructGetData($pHeader, 1), 3) = "ID3") Then Return
    
    For $i = 0 To 7
        $asInfo[$i] = ""
    Next
    
    $nTagInfo = DllStructGetData($pHeader, 3)
    $nTagSize = _SSIntToInt(DllStructGetData($pHeader, 4)) + 10
    
    If _IsBitSet($nTagInfo, 4) Then $nTagSize = $nTagSize + 10 ; Footer presented, RARE case
    If _IsBitSet($nTagInfo, 6) Then $nFrameOffset = 10 + _SSIntToInt(DllStructGetData($p, 5)); ExtHeader presented
    
    $pFrame = DllStructCreate("char[4];dword;short")
    
    While $nFrameOffset < $nTagSize
        $pFrame = _FileReadToStruct($pFrame, $hFile, $nFrameOffset)
        $sID = _DllStructArrayAsString($pFrame, 1, 4)
        $nFrameSize = _SSIntToInt(DllStructGetData($pFrame, 2))
        If $nFrameSize > $nTagSize Then ExitLoop
        $pTemp = _FileReadToStruct("byte;char[" & $nFrameSize - 1 & "]", $hFile, $nFrameOffset + 10)
        $sData = _DllStructArrayAsString($pTemp, 2, $nFrameSize - 1)
        Select
            Case $sID == "TIT2"; Title 
                $asInfo[0] = $sData
            Case $sID == "TPE1"; Performer (primary)
                $asInfo[1] = $sData
            Case $sID == "TPE2"; Performer (secondary)
                If $asInfo[1] == "" Then $asInfo[1] = $sData
            Case $sID == "TALB"; Album
                $asInfo[2] = $sData
            Case $sID == "TYER"; Year
                $asInfo[3] = $sData
            Case $sID == "COMM"; Required special
                If $asInfo[4] == "" Then; MS ShellExt tag editor add empty COMM at the end of tag...
                    $asInfo[4] = $sData
                    If DllStructGetData($pTemp, 2, 4) = 0 Then $asInfo[4] = StringTrimLeft($sData, 3)
                EndIf
            Case $sID == "TRCK"; Track number
                $asInfo[5] = $sData
            Case $sID == "TCON"; Genre
                $asInfo[6] = $sData
                $sData = StringRegExp($sData, "\((\d{1,3})\)", 1)
                If @extended Then $asInfo[6] = _MP3GetGenreByID($sData[0])
            Case $sID == "TLEN"; Length!
                $asInfo[7] = Int(Number($sData) / 1000)
                $asInfo[7] = StringFormat("%d:%02d", Int($asInfo[7] / 60), $asInfo[7] - Int($asInfo[7] / 60) * 60)
            Case StringLen($sID) < 4 Or Not StringIsAlNum($sID)
                ExitLoop; Zero-byte padding (end of tag), wrong sID -> Exitloop                        
        EndSelect
        $nFrameOffset = $nFrameOffset + $nFrameSize + 10  
        $pTemp = ""
    WEnd
    $pFrame = ""
    $pHeader = ""
    Return ($asInfo)
EndFunc

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Support functions;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Func _MP3GetGenreByID($iID)
    Local $asGenre = StringSplit("Blues,Classic Rock,Country,Dance,Disco,Funk,Grunge,Hip-Hop,Jazz,Metal,New Age," & _
            "Oldies,Other,Pop,R&B,Rap,Reggae,Rock,Techno,Industrial,Alternative,Ska,Death Metal,Pranks," & _
            "Soundtrack,Euro-Techno,Ambient,Trip-Hop,Vocal,Jazz+Funk,Fusion,Trance,Classical,Instrumental," & _
            "Acid,House,Game,Sound Clip,Gospel,Noise,Alternative Rock,Bass,Soul,Punk,Space,Meditative," & _
            "Instrumental Pop,Instrumental Rock,Ethnic,Gothic,Darkwave,Techno-Industrial,Electronic,Pop-Folk," & _
            "Eurodance,Dream,Southern Rock,Comedy,Cult,Gangsta,Top 40,Christian Rap,Pop/Funk,Jungle,Native US," & _
            "Cabaret,New Wave,Psychadelic,Rave,Showtunes,Trailer,Lo-Fi,Tribal,Acid Punk,Acid Jazz,Polka,Retro," & _
            "Musical,Rock & Roll,Hard Rock,Folk,Folk-Rock,National Folk,Swing,Fast Fusion,Bebob,Latin,Revival," & _
            "Celtic,Bluegrass,Avantgarde,Gothic Rock,Progressive Rock,Psychedelic Rock,Symphonic Rock,Slow Rock," & _
            "Big Band,Chorus,Easy Listening,Acoustic,Humour,Speech,Chanson,Opera,Chamber Music,Sonata,Symphony," & _
            "Booty Bass,Primus,Porn Groove,Satire,Slow Jam,Club,Tango,Samba,Folklore,Ballad,Power Ballad,Rhytmic Soul," & _
            "Freestyle,Duet,Punk Rock,Drum Solo,Acapella,Euro-House,Dance Hall,Goa,Drum & Bass,Club-House,Hardcore," & _
            "Terror,Indie,BritPop,Negerpunk,Polsk Punk,Beat,Christian Gangsta,Heavy Metal,Black Metal,Crossover," & _
            "Contemporary C,Christian Rock,Merengue,Salsa,Thrash Metal,Anime,JPop,SynthPop", ",")
    If ($iID >= 0) and ($iID < 148) Then Return $asGenre[$iID + 1]
    Return ("")
EndFunc

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Common functions;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Func _DllStructArrayAsString($p, $index, $size, $start = 1)
    Local $sTemp = ""
    For $i = $start To $size
        $sTemp = $sTemp & Chr(DllStructGetData($p, $index, $i))
    Next
    Return $sTemp
EndFunc

Func _SSIntToInt($nSSInt)
    Local $nRet = 0, $nCurByte
    For $i = 0 To 3
        $nRet = $nRet + BitShift(BitAND(BitShift($nSSInt, 8 * (3 - $i)), 0xFF), -7 * $i)
    Next
    Return ($nRet)
EndFunc

Func _IsBitSet($nNum, $nBit)
    Return BitAND(BitShift($nNum, $nBit), 1)
EndFunc

Func _FileReadToStruct($vStruct, $hFile, $nOffset)
    If Not DllStructGetSize($vStruct) Then $vStruct = DllStructCreate($vStruct)
    Local $nLen = DllStructGetSize($vStruct)
    Local $ret = DllCall("kernel32.dll", "int", "SetFilePointer", _
            "int", $hFile, _
            "int", $nOffset, _
            "int", 0, _
            "int", 0); FILE_BEGIN
    Local $pRead = DllStructCreate("dword")
    $ret = DllCall("kernel32.dll", "int", "ReadFile", _
            "int", $hFile, _
            "ptr", DllStructGetPtr($vStruct), _
            "int", $nLen, _
            "ptr", DllStructGetPtr($pRead), _
            "ptr", 0)
    If @error Then 
        SetError(1)
    EndIf
    Local $nRead = DllStructGetData($pRead, 1)
    $pRead = ""
    SetExtended($nRead)
    If not ($nRead = $nLen) Then SetError(2)
    Return $vStruct
EndFunc

get_mp3_tag_example.au3

#include "get_mp3_tag.au3"
Opt("MustDeclareVars", 1)
Opt("TrayIconDebug", 1)

Dim $iCnt, $sFile, $aData, $aLabel, $sOut = ""
$sFile = FileOpenDialog("Please select file", "", "MPEG files (*.mp3;*.mp2;*.mpa)");
If @error Then Exit
$aData = _MP3GetTag($sFile)
If @error Then 
    MsgBox (0, "MP3 Tag Info", "No TAG info was found.")
    Exit
Endif
$aLabel = StringSplit("Title: |Artist: |Album: |Year: |Comment: |Track number: |Genre: |Length: ", "|")
For $iCnt = 0 to UBound($aData) - 1
    $sOut = $sOut & $aLabel[$iCnt+1] & $aData[$iCnt] & @CR
Next
MsgBox (0, "MP3 Tag Info", $sOut)

Share this post


Link to post
Share on other sites

thanks it works


My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.

Share this post


Link to post
Share on other sites

#14 ·  Posted

I've got 3.1.1.75 but I keep getting a junk character at the start of each string that the example shows in the msgbox.

Any ideas?

Share this post


Link to post
Share on other sites

#15 ·  Posted

I've got 3.1.1.75 but I keep getting a junk character at the start of each string that the example shows in the msgbox.

Any ideas?

Strange, I'm just recheck latest 2.1 version with the latest Autoit beta and seems all works fine... This problem is only with certain files or for all? Can you send me part of file where this occurs?

Share this post


Link to post
Share on other sites

#16 ·  Posted

Man this rocks! I'm currently working on a mp3 player adn this is certainly going to do the playlist some good if I can implement it! Thanks! :think:


Don't take my pic to serious...~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~You Looked, but you did not see!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Share this post


Link to post
Share on other sites

#17 ·  Posted

Strange, I'm just recheck latest 2.1 version with the latest Autoit beta and seems all works fine... This problem is only with certain files or for all? Can you send me part of file where this occurs?

Now I'm beginning to get variable results.

Some files return ok , some files have the junk characters(If they have then it's always 2 characters)

and on some files, the example hangs till script is paused and then I get AutoIt error saying

Line 31 (File "C:\Program Files\AutoIt3\Include\get_mp3_tag.au3")

Local $vTag = _MP3GetV2Tag($ret[0])

Local $vTag = ^ERROR

Error: Error in expression

Let me see how I can differentiate the files and get back to you.

Share this post


Link to post
Share on other sites

#18 ·  Posted

I'm sorry there was no other way I could think of to get you the files.

Please download the following 3 mp3 files by copy+pasting the link in your browser and check the results using the example script

Total download appox. 15 mb

[http://songs.papuyar.com/browser/file_dl.php?sid=5260]

Returns leading junk characters.

[http://songs.papuyar.com/browser/file_dl.php?sid=11177]

Causes Error.

[http://songs.papuyar.com/browser/file_dl.php?sid=11118]

Returns ok.

Share this post


Link to post
Share on other sites

#19 ·  Posted (edited)

Thanks, I'm got files (this is most convenient way, btw).

1. File have unicode V2 tags (V1 are ok - they are not support unicode at all). But what's bad - UDF don't supported such tags... I'll try to find time and fix it (at least now I have files with such tags), but this can take a while... Atm you can force using V1 tags instead V2, to do that change two lines in _MP3GetTag functon:

Local $vTag = _MP3GetV1Tag($ret[0], FileGetSize($sFile) - 128)

If not IsArray($vTag) Then $vTag = _MP3GetV2Tag($ret[0])

2. I' don't sure, this file not cause error for me, but show no tags. V2 tag include huge jpeg file embedded (more then 500 kb), maybe this problem source, maybe not, need to look. Edited by Lazycat

Share this post


Link to post
Share on other sites

#20 ·  Posted

Thanks.

Now another question.

Is it always true that an mp3 file with V2 tags will have V1 tags too or it is an option to set tags depending on the software you use to set tags with?

If so then I can just disable checking for V2 tags and use V1...makes it simpler, right?

If not then I'm stuck.

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