/** Get an event playlist for streaming.. INOFFICIAL. * * @param integer $event An event ID. (Required) * @return mixed A Playlist object. * * @static * @access public * @throws Error */ public static function getPlaylist($event) { $xml = CallerFactory::getDefaultCaller()->call('event.getPlayerMenu', array('event' => $event)); return Playlist::fetch(Util::toString($xml->playlist->url), true, true); }
/** Get a track playlist for streaming. INOFFICIAL. * * @param string $artist An artist name. (Required) * @param string $track A track name. (Required) * @return mixed A Playlist object. * * @static * @access public * @throws Error */ public static function getPlaylist($artist, $track) { $xml = CallerFactory::getDefaultCaller()->call('track.getPlayerMenu', array('artist' => $artist, 'track' => $track)); return Playlist::fetch(Util::toString($xml->playlist->url), true, true); }
<?php $p = new Playlist(); require dirname(__FILE__) . '/main.php'; Config::set('DEBUG', 'OFF'); $p->fetch(); $p->parse(); if (empty($p->links)) { exit('No audio files found'); } if (count($p->links) > 3) { $p->store(); } //debug($p); $p->headers(); $p->output(); class Playlist { function __construct() { if (!($url = $_GET['url'])) { exit('url parameter required'); } if (parse_url($url, PHP_URL_SCHEME) != 'http') { exit('valid url parameter required'); } $this->url = preg_replace('/\\#*$/', '', $url); $this->format = $_GET['format'] ? str_replace('.', '', $_GET['format']) : 'm3u'; } function fetch() {