gobsor Posted December 19, 2010 Posted December 19, 2010 Hello once again!I've experianced another problem with I'm using the latest UDF version: http://www.autoitscript.com/forum/index.php?app=core&module=attach§ion=attach&attach_id=31144Here is my example code:#include <GUIConstantsEx.au3> #include "ID3.au3" GUICreate("test", 100, 100) $b = GUICtrlCreateButton("a", 40, 40, 20, 20) GUISetState(@SW_SHOW) While(1) $msg = GUIGetMsg() If $msg == $GUI_EVENT_CLOSE Then ExitLoop EndIf If $msg == $b Then _ID3SetTagField("TIT2", "title") _ID3SetTagField("TPE1", "artist") _ID3WriteTag("a.mp3") EndIf WEndWhen pressing button 'a' the file actually gets tagged, artist is set to 'artist', title is set to 'title', just somehow this messes up the length (playtime) shown in WinAMP. What am I doing wrong? Using the ID3_Example_GUI.au3 provided with the UDF it just works fine, apparently. Though, when I tag the'a.mp3' using my example code (I tried different *.MP3 files though) one file that has usually 3:45 playtime is after tagging, shown as 00:00. Another that should be 4:17 was after tagging showing '23:27' in WinAMP.Thanks in advance,gob
wakillon Posted December 20, 2010 Posted December 20, 2010 Here is my example code:I wanted to try, but In your example i don't see any mp3 path... AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts
gobsor Posted December 20, 2010 Author Posted December 20, 2010 I wanted to try, but In your example i don't see any mp3 path... What MP3 path? _ID3WriteTag("a.mp3") a.mp3 in same path like script?
wakillon Posted December 20, 2010 Posted December 20, 2010 What MP3 path? _ID3WriteTag("a.mp3") a.mp3 in same path like script? Ok i have replaced a.mp3 by mp3 path and it works well ! AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts
gobsor Posted December 21, 2010 Author Posted December 21, 2010 That's weird, because when I use this code on any *.MP3 file it screws the length ('playtime') of the file. When i add the file to my winamp playlist BEFORE tagging, it shows 3:14 length. When I tag it and re-drag&drop it into my playlist it suddently shows some wrong mm:ss length. Some MP3 files with ie. 3:25 length suddently show 23:46 or 22:16 or just 00:00. Any suggestions?
gobsor Posted December 21, 2010 Author Posted December 21, 2010 (edited) Ah, thanks. When reading tags, it gives you a NULL terminated string. Fields ('TPE1', 'TIT2') are apparently 30 chars in length, if artist name is less than 30 chars rest is filled with 0's. I guess I have to fill up my AutoIT strings with 0's then to get it working properly. I'll try when I find a few spare minutes and let you know the result. rgrds EDIT: Found some spare time right now.. Made this test code and 'null-terminate' my strings with it before using them on _ID3SetTag() provided by ID3 UDF. Works for me now. Not sure though if all fields have same length, but that's basically what to do to avoid the tag function screwing up MP3 length (playtime). Apparently the length of a track is the total size of headers or summat, too lazy to look it up right now but I'm sure one can find it on the official ID3vX website in the RFC. #include <File.au3> _strAddNULLTerm("yo this is test aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") Func _strAddNULLTerm($sString) $sStr = "" $aAsc = StringToASCIIArray($sString) $size = UBound($aAsc)-1 If $size > 29 Then For $i = 0 To 29 $sStr &= Chr($aAsc[$i]) Next Return $sStr Else $left = 29 - $size For $i = 0 To $size $sStr &= Chr($aAsc[$i]) Next For $i = 0 To $left-1 $sStr &= Chr(0) Next Return $sStr EndIf EndFunc ;==> _strAddNULLTerm($sString) Edited December 21, 2010 by gobsor
gobsor Posted December 21, 2010 Author Posted December 21, 2010 I lied.. It was pretty late yesterday and the example-test-code provided in my last code doesn't work. I commented out the old code when writing it and accidently set a comment for _ID3WrtieTag(), too, I didn't check if the tags were written I just checked for the length of the MP3-file displayed in WinAMP... I added _ID3WriteTag() and used NULL-termination when I noticed I accidently commented it out.. and guess what.. failed again! Though, even adding a NULL-termination to the strings doesn't work. Still screws the shown playtime. If anyone has further ideas.. I'm open for any suggestions. I'll keep on trying to get this working and keep you pasted if i find some workaround or any solution to this matter.
sleepydvdr Posted December 21, 2010 Posted December 21, 2010 The pattern I notice is that mp3s with v1 tags work fine. The v2 tags do not. The one on the left is a v.2 and the one on the right is v1. Short of diving into the UDF and fixing it, I think the only thing you could do is a recursive search of an array return to find the various fields. #include <ByteMe.au3>
BrewManNH Posted December 21, 2010 Posted December 21, 2010 If you open the song in the example gui from the ID3.udf thread does it display a length? Also, does it still show all of the other tags, the ones you didn't overwrite? Or, have you opened the file in an MP3 tag reader/writer program to see what's there or what's missing? 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 GudeHow 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
gobsor Posted December 22, 2010 Author Posted December 22, 2010 (edited) Opened it in WinAMP and viewed the fields there. Yeh, I came across other forum posts on that UDF. Seems its pretty glitched. If one who knows AU3 better than me could fix the UDF - *thumbs up*. If not, probably gonna use some DLL (found AudioGenie3.dll on Google which apparently supports most functions that I need). Though I thought without some external file (*.dll/*.exe/*.w/e) it would be sexier. @sleepy: If you're going to do the job keep us pasted please :-) regards Edited December 22, 2010 by gobsor
gobsor Posted December 22, 2010 Author Posted December 22, 2010 Thanks, already found this AudioGenie3 UDF. The MemoryDLL looks pretty interesting though. rgrds
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now