"nextShow":[{"id":"9","starts":"2013-06-20 17:00:00",
A fast way I found to tweet track data was to pull from the icecast server , via cron every few minutes..(or if you wanted to post on demand) but you could just as easily use api. .. I can forward script if you like ..
artist and title
$listen = '<a href=\"
http://x.com:80/din0.m3u\"></a><br />';
$msg = http_get("http://fx.com/getstatus.xsl"); // print_r($msg);
$spl = explode( '<pre>', $msg ) ;
$spl = str_replace( '</pre>', '', $spl[1] ) ;
$spl = explode( "<br/>", $spl ) ;
$flds = $spl[0] ;
$spl = explode( "\n", $flds ) ;
array_shift($spl) ;
// print_r($spl);
// Build stations information.
$stations = array();
// print_r($stations);
foreach ( $spl as $e ) {
// echo "xxx$e"; echo "\n";
if ( ($e !== " _END_") && ( $e !== " ") && ( $e !== "") && ( $e !== " MountPoint,Server Name,Description,Data Type,Bitrate,Quality,Video Quality,Frame Size,Frame Rate,Listeners,Peak Listeners,Genre,Server URL,Artist,Title" ) ) {
// Only for valid stations, reject empty and marker tags
$p = explode( '|', $e );
// print_r($p);
$stations[$p[0]]['Name'] = $p[1] ;
$stations[$p[0]]['Description'] = $p[2] ;
$stations[$p[0]]['Listeners'] = $p[9] ;
$stations[$p[0]]['Peak'] = $p[10] ;
$stations[$p[0]]['Artist'] = $p[14] ;
$stations[$p[0]]['Title'] = $p[13] ;
}
//print_r($stations);
}
// Prod playlist information first...
$curtitle = $stations[$fall]['Title'] ;
$curartist = $stations[$fall]['Artist'] ;
$listeners = $stations[$fall]['Listeners'] ;
$peak = $stations[$fall]['Peak'] ;
$stream = $stations[$fall]['Name'] ;
//echo $listen . "\n" ;
if ( !empty( $stations[$prod]['Name'] ) ) {
$curtitle = $stations[$prod]['Title'] ;
$curartist = $stations[$prod]['Artist'] ;
$listeners = $stations[$prod]['Listeners'] ;
$peak = $stations[$prod]['Peak'] ;
$stream = str_replace( 'on DinRadio', '', $stations[$prod]['Name'] ) ;
}
// Sanitize information, just for being sure it looks nice
or the api is something like this
$json_string = json_decode(file_get_contents('http://fx.com:8080/api/live-info'),TRUE);
//print_r($json_string);
$array =(array_values($json_string));
//print_r($array);
//print_r(array_count_values($array));
if (empty($array[2]['name'])||empty($array[3]['name'])||empty($array[4]['name']))
{
exit(0);
}
$now_ttitle = ($array[3]['name']);
$now_end = ($array[3]['ends']);
$now_strt = ($array[3]['starts']);
list($now_artist,$now_ttitle) = explode(" - ",$array[3]['name']);
$next_ttitle = ($array[4]['name']);
$next_end = ($array[4]['ends']);
$next_strt = ($array[4]['starts']);
list($next_artist,$next_ttitle) = explode(" - ",$array[4]['name']);
$prev_ttitle = ($array[2]['name']);
$prev_end = ($array[2]['ends']);
$prev_strt = ($array[2]['starts']);
list($prev_artist,$prev_ttitle) = explode(" - ",$array[2]['name']);
//print_r($array);
//print_r(array_keys($json_string));
this works with airtime api.. just add bitly,twitter keys and comments to suit.. uses php twitteroauth so you need to install latest version, and set path. its not perfect but should work for next show as well with change to arrays parameter... could either run from cron or get ajax/javascript to call it..
It looks like you're new here. If you want to get involved, click one of these buttons!