We are in the process of migrating the Spacial Wiki content to our new Help Center at spacial.com.
Please visit the Help Center for latest Tips and Tricks, Documentation and Troubleshooting.
How Do I fix the song lengths of my songs that are either invalid, or show -00:00?
How Do I fix the song lengths of my songs that are either invalid, or show -00:00? I ran into this problem a while back. So, I posted a request on the forums as to how to fix this. The answer that I got spawned this script. Basically, it reloads the song into an Auxillary player and grabs the song info from there. Then, it puts the correct song duration/length back into the database for that paticular song.
The only thing with this PAL script is that if you choose to run this on your entire database, it WILL take a long time. Also, you will need AUX1 free during the time that this script runs (You could change this).
And now the code:
var myQ : TDataSet; var filLoc : String; var Song1 : TSongInfo; //SQL if duration is less than .1 seconds myQ := Query('SELECT * FROM songlist WHERE duration < :value',, False); //SQL for all songs //myQ := Query('SELECT * FROM songlist WHERE songtype = :type',['S'], False); myQ.First; Song1 := TSongInfo.Create; while not myQ.EOF do begin filLoc := myQ['filename']; Song1['filename'] := filLoc; Song1['artist'] := myQ['artist']; Song1['title'] := myQ['title']; Aux1.QueueSong(Song1); ExecSQL('UPDATE songlist SET duration = :newduration where id = :songid',[Aux1.duration, myQ['ID']]); //to ensure that the duration field isn't carried over to the next song Aux1.Eject; myQ.Next; end; myQ.Free; Song1.Free;
Thanks to DJ Cassio for his initial help with this script.
You may download the script itself here. http://spacialaudio.com/knowledge/attachment.php?attId=116