Permalink
Browse files

Added Artist and Listeners to output

  • Loading branch information...
dlnetworks committed May 26, 2017
1 parent c1475b4 commit 5488b9b83de16d2a09ccb1c7ee18bd56af0361c2
Showing with 12 additions and 5 deletions.
  1. +12 −5 icecast.php
View
@@ -66,14 +66,20 @@ function characterData($parser, $data) {
// add more variables here to get more info from XML
global $listeners;
global $current_song;
global $title;
global $artist;
global $current_track;
if ($curTag == "^ICESTATS^SOURCE^LISTENERS") {
$listeners = $data;
}
if ($curTag == "^ICESTATS^SOURCE^ARTIST") {
$artist = $data;
}
if ($curTag == "^ICESTATS^SOURCE^TITLE") {
$current_song = $data;
$title = $data;
}}
// control for parsing xml data
@@ -83,10 +89,11 @@ function characterData($parser, $data) {
xml_parse($xml_parser, $xml);
xml_parser_free($xml_parser);
// tweet preview
print "$current_song";
// build tweet
$current_track = "#NowPlaying: $artist - $title - $listeners Listeners";
print "$current_track";
// post the tweet
$twitterObj->post('/statuses/update.json', array('status' => $current_song));
$twitterObj->post('/statuses/update.json', array('status' => $current_track));
?>

0 comments on commit 5488b9b

Please sign in to comment.