Jump to content

ID3 UDF ID3v1 & ID3v2 MP3 Tags


joeyb1275
 Share

Recommended Posts

Hello,

Is there anyone how still can work with this script?

With the coming of version 3.3.2.0 from Autoit it won't work anymore.

I've look to it but the script is to complicated for me.

Is there someone how have the answer for this?

Link to comment
Share on other sites

  • 4 months later...

Hello,

Is there anyone how still can work with this script?

With the coming of version 3.3.2.0 from Autoit it won't work anymore.

I've look to it but the script is to complicated for me.

Is there someone how have the answer for this?

I have been away from this forum for some time now, but I think I will have time to look into this. I would also like to add some of the fixes that I read about in these postings. Thanks to all the people contributing.

Link to comment
Share on other sites

I have been away from this forum for some time now, but I think I will have time to look into this. I would also like to add some of the fixes that I read about in these postings. Thanks to all the people contributing.

Yeah!!

I’ll look forward to it.

Link to comment
Share on other sites

  • 2 weeks later...

@joeyb1275 I've tryed a few thinks and I think it al works great.

Thanks a lot!

New ID3.au3 code posted, see first posting in this thread. Thanks to michael2t for all his help!

Let me know if there are any issues.

Link to comment
Share on other sites

  • 1 month later...

@joeyb1275 - You don't appear to have discovered & fixed the issue with Genre (TCON) not returning a value.

If you change -

Elseif $FrameID == "TCON" Then;Content Type/Genre
        $bTagFieldFound = True
        $bFrameData = Binary($aFrameData[2])
        $Genre = BinaryToString($bFrameData)
        If StringMid($Genre,1,1) == "(" Then ;check if first char is "("
            $closeparindex = StringInStr($Genre,")")
            $GenreID = StringMid($Genre,2,$closeparindex-1)
            $Genre = _GetGenreByID($GenreID)
        EndIf ;If no "(" then return the whole field as is
        $sFrameString = $Genre

to

Elseif $FrameID == "TCON" Then;Content Type/Genre
        $bTagFieldFound = True
        $bFrameData = Binary($aFrameData[2])
    $bFrameData = BinaryMid($bFrameData,2)
        $Genre = BinaryToString($bFrameData)
        If StringMid($Genre,1,1) == "(" Then ;check if first char is "("
            $closeparindex = StringInStr($Genre,")")
            $GenreID = StringMid($Genre,2,$closeparindex-1)
            $Genre = _GetGenreByID($GenreID)
        EndIf ;If no "(" then return the whole field as is
        $sFrameString = $Genre

in the _GetID3FrameString($sFrameData) function, that will do the trick.

You obviously missed including the line $bFrameData = BinaryMid($bFrameData,2). Without it, neither the genre number or text version get's returned.

Once again, thanks for sharing.

I use this UDF in a few of my programs now.

Apologies if this has been mentioned before, but if so it seems you've missed it (i.e. it's still missing from current ID3.au3).

Edited by TheSaint

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Link to comment
Share on other sites

  • 5 weeks later...

Hey there,

any chance to grab the playtime of the MP3 file in, lets say, seconds?

I thought "TIME" or "TLEN" does the job, but somehow it always returns an empty string ("") for me.

Any suggestions on how to read the track's length in seconds?

Regards

EDIT:

I found some cool UDF by RazerM, Melba23, some code by Simucal, PsaltyDS HERE, works on (at least all of my tested) mp3 files ;)

Cheers!

Edited by gobsor
Link to comment
Share on other sites

  • 2 months later...

(20100710) I have updated the ID3 UDF to work in the latest Autoit (v3.3.6.1)

Can anyone help me! I'm having problems using ID3.au3 and ID3_Example_GUI.au3 programs

the problem is, is that it don't seem to read some of my mp3 files.

opon opening the result shows

Artist - ÿþA

Album - ÿþV

Please note i have not edited the ID3.au3 and ID3_Example_GUI.au3 files

Whats going on?

Link to comment
Share on other sites

Can anyone help me! I'm having problems using ID3.au3 and ID3_Example_GUI.au3 programs

the problem is, is that it don't seem to read some of my mp3 files.

opon opening the result shows

Artist - ÿþA

Album - ÿþV

Please note i have not edited the ID3.au3 and ID3_Example_GUI.au3 files

Whats going on?

I believe that is something to do with Unicode text, but I may be wrong?

A quick work-a-round is to use values from File Properties instead, and then rewrite the values.

Do a search in the Forum for the relevant code (or UDF?).

Or use a program like Tagscanner to do it (but be aware, that it defaults to Unicode I think, so you'll need to change that setting).

Hopefully someone will implement a fix for it here before too long.

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Link to comment
Share on other sites

  • 3 months later...

I believe that is something to do with Unicode text, but I may be wrong?

A quick work-a-round is to use values from File Properties instead, and then rewrite the values.

Do a search in the Forum for the relevant code (or UDF?).

Or use a program like Tagscanner to do it (but be aware, that it defaults to Unicode I think, so you'll need to change that setting).

Hopefully someone will implement a fix for it here before too long.

Checkout the updates as of 20110310 (see first post) to see if this problem is corrected.

Link to comment
Share on other sites

Thanks for that, will check it out.

As well as the issue I mention at post #46, I've discovered and quick fixed a few others, including issues with parts of ID3 v1.

I don't know whether you've corrected any of these, but I can pass on to you what I have done so far if you like?

Edited by TheSaint

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Link to comment
Share on other sites

Thanks for that, will check it out.

As well as the issue I mention at post #46, I've discovered and quick fixed a few others, including issues with parts of ID3 v1.

I don't know whether you've corrected any of these, but I can pass on to you what I have done so far if you like?

Thanks for checking it out! I think I have that fix in there that you mention in post #46, but let me know if it works for you. If there is anything else that you found I would love to know about it. Thanks!

Link to comment
Share on other sites

No worries, will do.

I've attached my latest version of your UDF, which has some corrections commented by me. For any others I may have missed, you'll have to do a file text comparison.

Obviously your most recent changes have not been incorporated yet.

You no doubt understand this stuff better than me, so you may want to modify my quick corrections somewhat.

ID3.au3

Thanks again!

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Link to comment
Share on other sites

No worries, will do.

I've attached my latest version of your UDF, which has some corrections commented by me. For any others I may have missed, you'll have to do a file text comparison.

Obviously your most recent changes have not been incorporated yet.

You no doubt understand this stuff better than me, so you may want to modify my quick corrections somewhat.

ID3.au3

Thanks again!

This is great feedback! Thanks!

I want to look at some of the changes you put in there further, but I saw you added a conditional on line 758

; Memory fix by TheSaint (just to avoid crashing)(not a true fix)
If $FrameSize > 100000 Then
    $FrameSize = 100000
    $bad = 1
    ;MsgBox(262192, "$FrameSize", $FrameSize)
EndIf

Did you have problems with the $FrameSize being too big and crashing the program?

Edited by joeyb1275
Link to comment
Share on other sites

This is great feedback! Thanks!

I want to look at some of the changes you put in there further, but I saw you added a conditional on line 758

; Memory fix by TheSaint (just to avoid crashing)(not a true fix)
If $FrameSize > 100000 Then
    $FrameSize = 100000
    $bad = 1
    ;MsgBox(262192, "$FrameSize", $FrameSize)
EndIf

Did you have problems with the $FrameSize being too big and crashing the program?

A pleasure to help.

I don't recall the exact specifics now, but obviously this allowed me to quickly fix an issue where a crash happened (making my program exit) ... probably due to an illegal, oversize or corrupt ID3 tag entry, which can no longer occur now that I've updated the tag.

Edited by TheSaint

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Link to comment
Share on other sites

  • 2 weeks later...

I make a simple func to read SYLT. Enjoy~

Func _GetSynLyrics($hFile,$FrameLen)
    Local $LengthToRead = $FrameLen, $_head, $LyricsFilename = @ScriptDir & "\" & "SynLyrics.txt", $bReturn
    $ID3Filenames &= $LyricsFilename & "|"
    $s_head = FileRead($hFile,6)
    $s_Encoding = BinaryMid($s_head,1,1)
    $s_Language = BinaryMid($s_head,2,3)
    $s_Stamp = BinaryMid($s_head,5,1)
    $s_Type = BinaryMid($s_head,6,1)
    $LengthToRead -= 6
    $s_Descriptor = ''
    $Byte = FileRead($hFile,1)
    $sb_Descriptor = $Byte
    $LengthToRead -= 1
    While $Byte <> "0x00"
        $s_Descriptor &= BinaryToString($Byte)
        $Byte = FileRead($hFile,1)
        $sb_Descriptor &= $Byte
        $LengthToRead -= 1
    WEnd
    $bLyrics_Bin = FileRead($hFile,$LengthToRead)
    $SynText=Binary('')
    $i=1
;~  Do  
;~      $i+=1
;~      $nByte=BinaryMid($bLyrics_Bin,$i,1)
;~  Until $nByte <> "0x00"  
    While $i<$LengthToRead
        $SynBin=Binary('')
        While 1
            $nByte=BinaryMid($bLyrics_Bin,$i,1)
            $i+=1
            If $nByte="0x00" Then ExitLoop
            $SynBin &= $nByte
        WEnd
        $SynText&=StringToBinary(Dec(Hex(BinaryMid($bLyrics_Bin,$i,4))),1)
        $SynText&=BinaryMid(0x7C7C,1,2)
        $SynText&=$SynBin
        $SynText&=BinaryMid(0x0A0D,1,2)
        $i+=4
    WEnd
    $hLyricFile = FileOpen($LyricsFilename, 2) ;Open for write and erase existing
    FileWrite($hLyricFile,$SynText)
    FileClose($hLyricFile)
;~     Switch $bText_Encoding
;~      Case 0x00
;~          $Lyrics_Text = BinaryToString($bLyrics_Text)
;~      Case 0x01
;~          $Lyrics_Text = BinaryToString($bLyrics_Text,2)
;~  EndSwitch
    $bReturn = $s_Encoding & $s_Language & $SynText
    $bReturn &= "|" & $LyricsFilename
    Return $bReturn
EndFunc

call the func in _ReadID3v2

Switch $FrameID
                        Case "APIC" ;Picture (Write to File)
                            $FrameData = _GetAlbumArt($hFile,$FrameSize)
                        Case "USLT" ;Lyrics (Write to File)
                            $FrameData = _GetSongLyrics($hFile,$FrameSize)
                        Case "SYLT"
                            $FrameData = _GetSynLyrics($hFile,$FrameSize)
                        Case Else
                            $FrameData = FileRead($hFile,$FrameSize)
                    EndSwitch
Link to comment
Share on other sites

  • 3 weeks later...

This isn't working for me, Windows 7 Professional x86, administrator account. Sometimes it works fine and will change the tags when I write them, but most of the time it is blanking out the tags and making the file unplayable in any media player including VLC. I don't get any errors I just get a file with the tags removed and in one case it left the V2 song title and changed the artist name to the album title.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

This isn't working for me, Windows 7 Professional x86, administrator account. Sometimes it works fine and will change the tags when I write them, but most of the time it is blanking out the tags and making the file unplayable in any media player including VLC. I don't get any errors I just get a file with the tags removed and in one case it left the V2 song title and changed the artist name to the album title.

I get all kinds of garbage happening with this UDF so don't feel alone. It often tells me I need a different version. That's wrong, I just need a UDF that works. Idoesn't work on any Windows version I've tried it on but most problems are in Vista and Win 7, both 32 bit.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

I've run into issues in the past, where APE tags seem to be a possible culprit and stop updates happening.

Heaven's knows why APE tags need to be inserted into MP3 files?

I use foobar2000 (also see it's utilities right-click option), MP3Tag and/or Tagscanner to fix issues that arise, plus MP3Val to do a final validation.

Most of the time (i.e. with my own LAME ripped tracks) I don't have issues with the UDF.

Various downloads sometimes have header issues or junk in the files, etc.

EDIT

That's with WinXP though.

Edited by TheSaint

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Link to comment
Share on other sites

@joeyb1275 - just a quick mention in passing, as I haven't yet had a chance to check it out properly, but a bunch of MP3's in a folder I was checking out, kept causing my program to crash when parsing the tags. One thing I noticed about all the Track Title tags, were that they all started with a time and then text (i.e. 12:30 Last Train). I'm guessing at this point, that the illegal filename character of ':' is at fault somehow. If I remember correctly, it was a Roger Waters album ... not that that is important I suppose.

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...