echo 'Same-station match found with songid ', $songid, ', deleting', PHP_EOL;
         // Delete the match found, it will be recreated later with a higher id
         if (!$deleteplaylists->execute()) {
             echo 'Error deleting: ', $deleteplaylists->error, PHP_EOL;
         }
     } else {
         echo 'Different-station match found with songid ', $songid, PHP_EOL;
     }
 }
 if ($songid == '') {
     if ($searchcounter <= SEARCH_LIMIT && $searchesrunningtotal + $searchcounter <= SEARCH_HOURLY_LIMIT) {
         $deletesearchqueue->execute();
         $searchcounter++;
         if (!$GSAPI) {
             require_once GSAPI_DIR . 'gsSearch.php';
             $GSAPI = new gsapi(GS_WS_KEY, GS_SECRET);
             $GSAPI->startSession();
             $GSAPI->getCountry($_SERVER['72.64.99.183']);
             $GSAPISearch = new gsSearch();
         }
         $GSAPISearch->setTitle($title);
         $GSAPISearch->setArtist($artist);
         $results = $GSAPISearch->songSearchResults(20);
         $stationstats[$stationid]['searches']++;
         if (count($results) < 1) {
             continue;
         }
         if ($results == null) {
             echo 'No search results, adding to noresults table (this script search counter: ', $searchcounter, ' hourly running total: ', $searchesrunningtotal, ')', PHP_EOL;
             $noresults->execute();
             continue;
Example #2
0
<?php

/**
 * @author James Hartig
 * @copyright 2010
 * https://github.com/fastest963/GroovesharkAPI-PHP
 */
error_reporting(E_ALL);
ob_implicit_flush(true);
if (isset($_POST['gsuser']) && isset($_POST['gspass'])) {
    require "gsapi.php";
    $API_KEY = '0c67b45dab926f5561a67a3c4caf7422';
    $API_SECRET = '';
    $gsapi = new gsapi($API_KEY, $API_SECRET);
    //it is advised to store session of the logged in user INSTEAD of the username and password. Sessions work for 2 weeks if they are unused, they will last indefinitely if used at least once every 2 weeks.
    //if you stored a session use: setSession()
    var_dump($gsapi->startSession());
    /*if you DID NOT use the following code below and didn't tokenize the password then you need to do:	
    	$token = gsapi::getUserToken($_POST['gsuser'],$_POST['gspass']);
    	$user = $gsapi->authenticateUser($_POST['gsuser'],$token);
    	otherwise...
    	*/
    $user = $gsapi->authenticateUser($_POST['gsuser'], $_POST['gspass']);
    //$user = $gsapi->getUserInfoFromSessionID();
    //$userid = gsapi::getUserIDFromUsername($_POST['gsuser']);
    /*echo "<h1>User Info</h1>";
    	echo "<ul><li>Username: "******"</li><li>UserID: ".$user['UserID']."</li><li>VIP :".($user['IsPremium'] ? "Yes" : "No")."</li></ul>";
    	echo "<h1>Playlists</h1>";
    	$playlists = $gsapi->getUserPlaylists();
    	echo "<ul>";