$totaldiscs || $start < 0) $start = $totaldiscs - $count; fseek($fp, 57 * $start, SEEK_SET); $n = $count; while($line=fgets($fp)) { $name = trim($line); if (file_exists($name)) $lines[]=$name; if (--$n <= 0) break; } fclose($fp); printf("

Recent additions:

"); include 'table_start.php'; ?> $imgs = ''; if ($lines) foreach(array_reverse($lines) as $line) { $ctdb = new phpCTDB($line); $disc = $ctdb->db['discs'][0]; $ctdb->ParseToc(); //$id = @$disc['MBID']['value']; $artist = @$disc['ART ']['value']; $title = @$disc['nam ']['value']; $discid = substr($line,13,30); $ctdbid = $ctdb->db['discs'][0]['CRC ']['int']; if ($artist == "" && $title == "") { //$q = new MusicBrainzQuery(new WebService('db4.cuetools.net')); $q = new MusicBrainzQuery(); $rf = new ReleaseFilter(); try { $rresults = $q->getReleases( $rf->discId($ctdb->mbid) ); foreach ( $rresults as $key => $rr ) { $rr = $rr->getRelease(); $artist = $rr->getArtist()->getName(); $title = $rr->getTitle(); $imgs = $imgs . ''; } } catch ( ResponseError $e ) { // echo $e->getMessage() . " "; } } printf('', htmlspecialchars($artist), htmlspecialchars($title), $ctdb->mbid, $discid, $discid, $ctdbid, $ctdbid); } printf('', $count * floor(($start - 1) / $count)); printf("
ArtistAlbumDisc IdCTDB Id
%s%s%s%08x
More
"); include 'table_end.php' ; //printf('%s', $imgs); printf("
"); ?>