function makeLrc($id) { if (empty($id)) { return; } $lrc = getSongInfo($id, "lyricsUrl"); if ($lrc) { $data = getContents($lrc); echo $data; } }
//echo "Handshake Failed (waiting $wait seconds): ".$as->getErrorMsg()."\n"; updateScrobblerResult($_SERVER['argv'][1], "Handshake Failed: " . $as->getErrorMsg()); sleep($wait); $wait = $wait * 2; } } $sql = "SELECT * FROM grammafone_audioscrobbler WHERE user_id=" . $_SERVER['argv'][1]; $wait = 60; $success = FALSE; while (!$success && $wait <= 7200) { $result = mysql_query($sql); $songs = array(); if (mysql_num_rows($result) > 0) { $now = time(); while ($row = mysql_fetch_array($result)) { $song = getSongInfo($row['song_id']); $songs[] = $row['as_id']; if ($song['length'] > 30) { $as->queueTrack($song['artist_name'], $song['album_name'], $song['name'], $row['as_timestamp'], $song['length']); } } if ($as->submitTracks()) { //echo "Submit Success\n"; $success = TRUE; $songs_sql = implode(" OR as_id=", $songs); $sql = "DELETE FROM grammafone_audioscrobbler WHERE as_id={$songs_sql}"; mysql_query($sql); updateScrobblerResult($_SERVER['argv'][1], "Successfully submitted " . count($songs) . " songs to AudioScrobbler"); } else { //echo "Submit Failed (waiting $wait seconds): ".$as->getErrorMsg()."\n"; updateScrobblerResult($_SERVER['argv'][1], "Submit Failed: " . $as->getErrorMsg());
<?php session_start(); include "newexec.php"; if ($_GET['dl'] == 1) { $songInfo = json_decode(getSongInfo($_GET["songid"]), true); header('Content-Disposition: audio/mpeg; filename=' . $songInfo["result"]["song"]["artistName"] . " - " . $songInfo["result"]["song"]["songName"] . '.mp3'); } else { header('Content-Type: audio/mpeg'); } if (!function_exists('http_parse_headers')) { function http_parse_headers($header) { $retVal = array(); $fields = explode("\r\n", preg_replace('/\\x0D\\x0A[\\x09\\x20]+/', ' ', $header)); foreach ($fields as $field) { if (preg_match('/([^:]+): (.+)/m', $field, $match)) { $match[1] = preg_replace('/(?<=^|[\\x09\\x20\\x2D])./e', 'strtoupper("\\0")', strtolower(trim($match[1]))); if (isset($retVal[$match[1]])) { $retVal[$match[1]] = array($retVal[$match[1]], $match[2]); } else { $retVal[$match[1]] = trim($match[2]); } } } return $retVal; } } //$songInfo = json_decode(getSongInfo($_GET["songid"]), true); //echo $songInfo["result"]["song"]["artistName"]. " - " . $songInfo["result"]["song"]["songName"]; $streamData = json_decode(getStreamURL($_GET["songid"]), true);