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));
$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;