function findAlbums($band)
{
    $id = getArtistId($band);
    $albums_info = file_get_contents("https://api.spotify.com/v1/artists/" . $id . "/albums?market=US&album_type=album,single");
    $result = json_decode($albums_info, true);
    $albums = $result["items"];
    $all_albums = array();
    foreach ($albums as $album) {
        $full_info_url = $album["href"];
        $full_info = json_decode(file_get_contents($full_info_url), true);
        $name = $full_info["name"];
        if (!strpos($name, "Commentary")) {
            $all_albums[$name] = $full_info;
        }
    }
    return $all_albums;
}
function selectParamQuery($sqlStr)
{
    $db = initiateDb();
    $numOfParam = substr_count($sqlStr, '?');
    $artistId = getArtistId();
    $workId = getWorkId();
    try {
        $results = $db->prepare($sqlStr);
        if (intval($workId)) {
            $results->bindParam(1, $workId);
        } elseif (intval($artistId)) {
            $results->bindParam(1, $artistId);
        }
        $results->execute();
    } catch (Exception $e) {
        echo $e->getMessage();
        die;
    }
    $artist = $results->fetchAll(PDO::FETCH_ASSOC);
    if ($artist == FALSE) {
        echo "Our Appologies No Artist was Found with the Provided Id";
    }
    return $artist;
}
Example #3
0
<?php

$page = "work";
$subPage = "work";
require_once $_SERVER["DOCUMENT_ROOT"] . "/php/includes/config.php";
require_once ROOT_PATH . 'php/functionList.php';
include ROOT_PATH . 'php/displayLargePreview.php';
include ROOT_PATH . 'php/ignoreList.php';
$urlArtistId = getArtistId();
$urlWorkId = getWorkId();
if (in_array($urlArtistId, $ukranians)) {
    $artWorks = selectQuery('select * from art_works where ' . printUkranians($ukranians) . ' ORDER BY availability, media');
} elseif (in_array($urlArtistId, $change_order)) {
    $artWorks = selectParamQuery('select * from art_works where `artist`=' . $urlArtistId . '  ORDER BY availability desc, category, media desc');
} else {
    $artWorks = selectParamQuery('select * from `art_works` where `artist`=' . $urlArtistId . ' ORDER BY availability, media');
}
$artistN = selectParamQuery('select artist_name from artists where artist_id =' . $urlArtistId);
$artistFullName = $artistN[0]["artist_name"];
$title = $artistFullName . ", ";
$keywords = $artistFullName . " ,";
$description = "Detailed view of art works by " . $title . " available at the Sloane Gallery of Art, Denver CO";
$mainContentHTML = "";
foreach ($artWorks as $artWork) {
    $artistN = selectParamQuery('select artist_name from artists where artist_id =' . $artWork["artist"]);
    $keywords .= str_replace('"', '', $artWork["title"]) . " , ";
    if (setArtWork($artWork) && !in_array($artWork["work_id"], $ignoreListArtWorks)) {
        $mainContentHTML .= largePreviewContainer($artWork, $artistFullName, $urlArtistId);
    }
}
include ROOT_PATH . 'php/includes/header.php';
$id = $_GET['id'];
// $base_url = "http://jennysmusicgallery.herokuapp.com/";
$base_url = "";
include "bands.php";
if ($id >= count($bands)) {
    header('Location: ' . $base_url . 'notfound');
}
?>

<!DOCTYPE html>
<html>

<?php 
include "functions.php";
$band = $bands[$id];
$artist_id = getArtistId($band);
$json_file = decodeJSON($artist_id);
$favicon = getArtistFavicon($json_file);
?>

<head>
  <meta charset="UTF-8">
  <title><?php 
echo $band . " // Jenny's Music Gallery";
?>
</title>
  <link rel="stylesheet" href="<?php 
echo $base_url;
?>
style.css" type="text/css">
  <link href='http://fonts.googleapis.com/css?family=Lato:100,300,400,100italic,300italic' rel='stylesheet' type='text/css'>
Example #5
0
}
$artist = json_decode($dump)->artist;
$exist = artistExist($dbHandle, addslashes($artist->name));
if ($exist) {
    fprintf($fp, "DUP artist, skipping artist\n");
    $warning_count++;
} else {
    $sql[0] = "INSERT INTO artist_list (artist_name) VALUES ('" . addslashes($artist->name) . "')";
    $sql[1] = "SELECT * FROM artist_list WHERE `artist_name`='" . addslashes($artist->name) . "'";
    if (!insertQuery($dbHandle, $sql)) {
        fprintf($fp, "Unable to add artist to database\n");
        fclose($fp);
        echo "Failed adding artist";
        exit;
    }
    if (!($artistId = getArtistId($dbHandle, addslashes($artist->name)))) {
        fprintf($fp, "Unable to retrieve artist id\n");
        fclose($fp);
        echo "Failed getting artist id";
        exit;
    }
    if ($artistId == 0) {
        fprintf($fp, "0 was grabbed as artist ID, not continuing\n");
        fclose($fp);
        echo "Failed getting artist id";
        exit;
    }
    $imageLength = getImageListLength($artist->image);
    insertImageUrl($dbHandle, $artist->image, $imageLength, $artistId, 0, $ARTIST_ARTWORK_FLAG, array(0 => $ARTIST_ARTWORK_FLAG, 1 => $ALBUM_ARTWORK_FLAG), $MAX_IMAGE_COUNT);
    saveBio($artistId . "-artist_bio.txt", $artist->bio->content, $fp, $DATABASE_SCRIPT_DIR, $DS_ARTIST_BIO_DIR, $DS_LOGS_DIR);
    $dbHandle->query("UPDATE artist_list SET \n                    `bio_file`='" . addslashes($artistId . "-artist_bio.txt") . "', time_added='" . getRandom() . "' WHERE artist_id='" . $artistId . "'");