function get_imagesearch_info($key) { // Used by getalbumcover.php to get album and artist names etc based on an Image Key $retval = array(false, null, null, null, null, null, false); if ($result = generic_sql_query("SELECT Artistname, Albumname, mbid, Albumindex, AlbumUri FROM Albumtable JOIN Artisttable\n\t\tON AlbumArtistindex = Artistindex WHERE ImgKey = '" . $key . "'")) { // This can come back with multiple results if we have the same album on multiple backends // So we make sure we combine the data to get the best possible set while ($obj = $result->fetch(PDO::FETCH_OBJ)) { if ($retval[1] == null) { $retval[1] = $obj->Artistname; } if ($retval[2] == null) { $retval[2] = $obj->Albumname; } if ($retval[3] == null || $retval[3] == "") { $retval[3] = $obj->mbid; } if ($retval[4] == null) { $retval[4] = get_album_directory($obj->Albumindex, $obj->AlbumUri); } if ($retval[5] == null || $retval[5] == "") { $retval[5] = $obj->AlbumUri; } $retval[0] = true; $retval[6] = true; debuglog("Found album " . $key . " in database", "GETALBUMCOVER", 6); } } return $retval; }
function do_covers_db_style() { global $count; global $albums_without_cover; global $allfiles; $alist = get_list_of_artists(); foreach ($alist as $artist) { print '<div class="cheesegrater" name="artistname' . $artist['Artistindex'] . '">'; print '<div class="albumsection crackbaby">'; print '<div class="tleft"><h2>' . $artist['Artistname'] . '</h2></div><div class="tright rightpad"><button onclick="getNewAlbumArt(\'#album' . $count . '\')">' . get_int_text("albumart_getthese") . '</button></div>'; print "</div>\n"; print '<div id="album' . $count . '" class="fullwidth bigholder">'; print '<div class="containerbox covercontainer" id="covers' . $count . '">'; $colcount = 0; $blist = get_list_of_albums($artist['Artistindex']); foreach ($blist as $album) { print '<div class="expand containerbox vertical albumimg closet">'; print '<div class="albumimg fixed">'; $class = "clickable clickicon clickalbumcover droppable"; $src = ""; if ($album['Image'] && $album['Image'] !== "") { $src = $album['Image']; if (($key = array_search($src, $allfiles)) !== false) { unset($allfiles[$key]); } } else { $class = $class . " notexist"; $albums_without_cover++; } print '<input type="hidden" value="' . get_album_directory($album['Albumindex'], $album['AlbumUri']) . '" />'; print '<input type="hidden" value="' . rawurlencode($artist['Artistname'] . " " . munge_album_name($album['Albumname'])) . '" />'; print '<img class="' . $class . '" name="' . $album['ImgKey'] . '" height="82px" width="82px" '; if ($src != "") { print 'src="' . $src . '" '; } print '/>'; print '</div>'; print '<div class="albumimg fixed"><table><tr><td align="center">' . $album['Albumname'] . '</td></tr></table></div>'; print '</div>'; $colcount++; if ($colcount == 8) { print "</div>\n" . '<div class="containerbox covercontainer">'; $colcount = 0; } $count++; } print "</div></div></div>\n"; } }