<?php
// auto_covers.php: Automatically fetch album covers from last.fm
//
// By: Jesper S.
require_once("sql.php");
require_once("set_td_colors.php");
require_once("disp.php");
require_once('lastfm_lib.php');
$special = 1;
$special=only_digits($special); // 0.7.6
$nr=1;
$qry="SELECT MAX(album.aid) AS maxnum FROM album";
$result=execute_sql($qry,0,1,$nr);
$row=mysql_fetch_array($result);
$total = $row['maxnum'];
print "Preparing: ".$total. "\n<br>";
while ($special < $total+1) {
$qry="SELECT * FROM album WHERE album.aid=".$special;
$header_result=execute_sql($qry,0,-1,$nr);
$header_row=mysql_fetch_array($header_result);
if($header_row['aperformer_id'] > 0){
$performer = get_performer_name($header_row['aperformer_id']);
echo "Looking up: ". $header_row['aid']." - ".$performer." - ".$header_row['aname']."\n<br>";
$cover=lastfm_get_cover($header_row);
}
if(strlen($header_row['bio_short']) < 3) {
$albumbio=lastfm_get_album_bio($header_row['aid'],$performer,$header_row['aname'],0,1);
}
$special++;
}
?>