Exemplo n.º 1
0
    $api_key = $_wt_options->options("lastfm_key");
    $artist = $_GET['artist'];
    $msg = "";
    $album = $_GET['album'];
    $lastfm_base_url = "http://ws.audioscrobbler.com/2.0/?method=album.getinfo&api_key={$api_key}";
    $lastfm_query = "&artist=" . urlencode($artist) . "&album=" . urlencode($album) . "&format=json&autocorrect=1";
    $lastfm_query_url = $lastfm_base_url . $lastfm_query;
    $response = wt_file_get_contents($lastfm_query_url);
    $response = json_decode($response);
    //print_r($response);
    if ($response->album) {
        $album = $response->album;
        $release_date_format = "";
        $release_date_format = date('Y-m-d', strtotime(trim($album->releasedate)));
        if ($release_date_format) {
            $release_date = WT_DBPrepere::admin_date_out($release_date_format);
        }
        $title = $album->name;
        $artist = $album->artist;
        $about = $album->wiki ? $album->wiki->content : "";
        $tracks = $album->tracks ? $album->tracks->track : array();
    } else {
        if ($response->error) {
            $msg = $response->message;
        }
    }
    ?>
<style>
#import-album-dialog .checkbox {
	width:30px;
	margin-top:5px;
Exemplo n.º 2
0
    if ($_GET['method'] == "track") {
        $yql_base_url = "http://query.yahooapis.com/v1/public/yql";
        $yql_query = "select * from music.track.search where keyword=\"" . $_GET['term'] . "\"";
        if (!empty($_GET['artist'])) {
            $yql_query .= " AND Artist.name LIKE \"%{$_GET['artist']}%\"";
        }
        $yql_query .= " LIMIT {$max_result}";
        $yql_query_url = $yql_base_url . "?q=" . urlencode($yql_query);
        $yql_query_url .= "&format=json";
        $response = wt_file_get_contents($yql_query_url);
        $response = json_decode($response);
        if ($response->query->results) {
            $tracks = $response->query->results->Track;
            $result = array();
            foreach ($tracks as $track) {
                $result[] = array("duration" => $track->duration, "release_year" => $track->releaseYear, "title" => $track->title, "artist" => $track->Artist->name, "album" => $track->Album->Release->title, "album_release_date" => WT_DBPrepere::admin_date_out($track->Album->Release->releaseDate), "label" => $track->Album->Release->label);
            }
        }
    }
    echo json_encode($result);
    exit;
}
if (isset($_GET['term']) && $_GET['type'] == "country") {
    $countries = get_countries();
    $term = strtolower($_GET['term']);
    $result = array();
    $max_result = isset($_GET["maxRows"]) ? (int) $_GET["maxRows"] : 10;
    $i = 0;
    foreach ($countries as $code => $country) {
        if (stripos(strtolower($country), $term) !== false && $i < $max_result) {
            array_push($result, array("term" => $code, "value" => $country));
Exemplo n.º 3
0
     try {
         $r = $eventbrite->response;
         if ($r["error"]) {
             if ($r["error"]["error_type"] == "Region error") {
                 $r["error"]["error_message"] = $r["error"]["error_message"] . "<br/>Refer to the venue administration page, could be because venue is missing a state value";
             }
             if ($r["error"]["error_type"] == "Not Found") {
                 $r["error"]["error_message"] = $r["error"]["error_message"] . "<br/>Event dosn't exist in Eventbrite, Please try again";
             }
             echo json_encode(array("type" => "error", "msg" => "Error publishing event to eventbrite:<p>" . $r["error"]["error_message"] . " (" . $r["error"]["error_type"] . ")</p>"));
             exit;
         } else {
             if ($r["process"]) {
                 $social = new WT_Social();
                 $social_row = $social->get_by_event($_POST["eventbrite_event_id"], "ebevent");
                 echo json_encode(array("type" => "success", "url" => "http://www.eventbrite.com/myevent?eid={$eb_id}", "tickets" => "http://www.eventbrite.com/event/{$eb_id}", "publish_date" => WT_DBPrepere::datetime_short_out($social_row["social_publish_time"]), "eventbrite" => $r));
                 exit;
             }
         }
     } catch (Exception $e) {
     }
     echo json_encode(array("type" => "error", "msg" => "Error connecting to Eventbrite, Please try again later"));
     break;
 case "import-eventbrite-events":
     $eventbrite = new WT_Eventbrite();
     $eventbrite->import($_POST["artist_id"]);
     echo json_encode($eventbrite->response);
     break;
     // GENERAL
 // GENERAL
 case "panel-state":