microthick, thaks for that class! However, I already found one that I think it's better since it has the ability to both read and write id3v1, id3v2 and ape tags. In case anyone else wants it, here goes the URL:
http://www.getid3.org
As for the code, I'm posting it here... I decided to implement an all-random code - I know most of you will think this isn't the best solution, but it works and since a 700mb cd can hold only a few albums (around 10), the random loop won't be too long. This is an adapted code that picks the cd information from an array instead of a database. Also, I'm brazilian so the prints and variable names will probably be uninteligible to you

It may not be 100% functional, but there goes!
Code: Select all
<?php
$cds = array("101","71","105","49","52","65","95","101","209","86","60","56","54","35","70","101","94","73","64","69");
rsort($cds);
reset($cds);
$total_albums = count($cds);
$satisfeito = 0;
/* uncomment to output information about all albums... a simple array contents display loop :)
for ($i = 0; $i < $total_albums; $i++) {
print("#".$i." - ".$cdsї$i]." mb<br>");
}
*/
do {
$sorteados = "-";
$ts = 0;
for ($i = 0; $i < $total_albums; $i++) {
$sorteado = rand(0,($total_albums-1));
$valor = $cdsї$sorteado];
if (substr_count($sorteados,"-".$sorteado."-") == 0 && $ts + $valor < 698) {
$sorteados .= $sorteado . "-";
$ts += $valor;
}
}
if ($ts > 690 && $ts < 698) {
$satisfeito = 1;
}
} while ($satisfeito == 0);
print("<br>Total: ".$ts."<br>Álbuns: ".$sorteados);
?>
If you have any questions about this code, just ask and I'll be glad to help!!
Best Regards,
SKEPTiKAL[/php_man]