Not any type of counters just one loop to read through the .txt which is created for the mp3 directory list. Here's the current code I'm using:
alias mp3db.make {
if (!$hget(mp3)) { ^mp3_load_db }
if ($hget(mp3,0).item == $findfile($sound(mp3),*.mp?,0)) {
echo -s -> MP3 DB is up-to-date.
return
}
echo -s -> Updating mp3 database...
var %ticks $ticks, %a, %b, %str, %idx 0, %temp, %mpeg
_mp3dirlist
while (%idx < $lines(myoutput.txt)) {
inc %idx
%temp = $read(myoutput.txt, nl, %idx)
if ($isfile($gettok(%temp,1,32))) {
if (!$hget(mp3,$gettok(%temp,1,32))) {
%a = $gettok(%temp,1,32)
%b = $gettok(%temp,2,32)
%mpeg = $mpeginfo(%a)
tokenize 32 %mpeg
%str = $+($1,$chr(9),$2,$chr(9),$3,$chr(9),$4-,$chr(9),$lower($bytes(%b).suf))
.hadd mp3 %a %str
}
}
}
.hsave -ob mp3 $scriptdirmp3.db
.remove myoutput.txt
echo -s -> MP3 database updated in $:ms(%ticks) seconds.
}