since you are using a *nix enviroment. (I assume from the /mp3/... style) then you could do something kinda dirty.
You could use the locate program to look for all .mp3's then pipe the output to a file and read from the file. I say dirty cause you might have stray mp3s or something.
Ex:
// Run locate and pipe it into a file
exec("locate .mp3 > mp3.out");
$mp3s = file("mp3.out");
$i = 0;
while ($i < sizeof($mp3s)) {
// Seperate each line into aritst etc...
$parsearray = explode("/",$mp3s);
$artist = $parsearray[1];
$album = $parsearray[2];
$trackmp3 = $parsearray[3];
// Explode again to seperate the Track number and song
$blaharray = explode("-",$trackmp3);
$tracknumber = $blaharray[0];
// lastly lop off the .mp3
$songtmp = explode("."$blaharray[1]);
// Put in the name of the song with no .mp3
$songname = $songtmp[0];
// then you have all your parts so do database stuff
Database.........Input....
// Remember to up the flag
$i++;
}
As I said this is kinda a dirty way to do it and you might get file that dont need to be in there, so be careful. Oh fair warning I havent tested this code so dont take it as Bible. 🙂
Hope that Helps!