Exemple #1
0
        <script src="resources/js/comms.js"></script>
        <script src="resources/js/script.js"></script>

    </head>
    <body>
        <?php 
include 'constants.php';
include 'functions.php';
include 'uweproxy.php';
// Grabs track information for the artist //
$results = json_decode(uwe_file_get_contents("http://developer.echonest.com/api/v4/artist/songs?api_key=" . $ECHONEST_API_KEY . "&name=" . urlencode($_POST['artist']) . "&format=json&start=0&results=" . $MAX_LIST));
echo '<div class="artistlist">';
$i = 0;
echo '<div class="title text">Tracks</div><hr />';
// Loops all tracks and checks if the track has a preview avaliable //
foreach ($results->response->songs as $child) {
    if (($url = getPreviewEcho($_POST['artist'], $child->title, $ECHONEST_API_KEY, false)) != false) {
        echo "<div class=\"text\"><a href=\"song.php?url=" . $url . "&title=" . $child->title . "\">" . $child->title . "</a></div>";
        echo "<hr />";
        $i++;
    }
}
if (!$i) {
    echo "No tracks available";
}
echo '</div>';
?>

        <div class="reset"><a href="index.php"><img src="resources/images/reset.png"/></a></div>
    </body>
</html>
Exemple #2
0
include 'login_functions.php';
include 'functions.php';
include 'constants.php';
include 'getSongPreview.php';
if (!($dbHandle = dbConnect($dbHandle, $DBHOST, $DBUSER, $DBPASS, $DBNAME))) {
    echo "Unable to find preview";
    exit;
}
$track = $_POST['track'];
$trackResult = $dbHandle->query("SELECT * FROM track_list WHERE `track_name`='" . addslashes($track) . "'");
if ($trackResult->num_rows < 1) {
    echo "Unable to find preview";
    exit;
}
$trackReturn = $trackResult->fetch_array(MYSQLI_BOTH);
if (!($albumInfo = getSingleRow($dbHandle, "album_list", "album_id", $trackReturn['album_id']))) {
    echo "Unable to find preview";
    exit;
}
if (!($artistInfo = getSingleRow($dbHandle, "artist_list", "artist_id", $albumInfo['artist_id']))) {
    echo "Unable to find preview";
    exit;
}
if (!getPreviewEcho($artistInfo, $track, $ECHONEST_API_KEY)) {
    if (!getPreviewLastFM($artistInfo, $track, $LASTFM_API_KEY)) {
        echo '<img src="images/error.png" />';
        exit;
    }
}
exit;