last songs played
Please don't use the forums to report outages, particularly if you are a FreeStreamHosting.org user.
last songs played
I've noticed that the only way listernes can see the 10 last songs played are on a page where there's also a logon and other things.
Is it possible to get ONLY the 10 last songs played?
- prideplay
- Posts: 3
- Joined: Thu 14th Jan, 2010 6:38 am
Re: last songs played
Download the Shoutcast class and try this php script.
- Code: Select all
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Shoutcast Test Page</title>
<style type="text/css">
.songOverview {
width:30%;
border:1px solid black;
background-color: #EEE;
}
.songOverview td {
padding: 1px 10px 1px 1px;
}
</style>
</head>
<body>
<?php
require_once ('shoutcast_class.php');
///YOUR RADIO CONFIGURATION IP & PORT///
$ip = "stream_address_here";
$port = "port_here";
////////////////////////////////////////
$radio = new Radio($ip.":".$port);
// ALL POSSIBLE INFORMATION //
$display_array = array(
"Stream Title",
"Stream Genre",
"Stream URL",
"Current Song",
"Server Status",
"Stream Status",
"Listener Peak",
"Average Listen Time",
"Content Type",
"Stream AIM",
"Stream IRC"
);
$data_array = $radio->getServerInfo($display_array);
echo "<table style=\"background-color: #CCC; border: 1px solid black;\">\n";
if (is_array($data_array))
{
foreach ($display_array AS $i => $text)
{
if ($text == "Stream Genre")
{
$datastring = "<span style=\"color: lightgrey; background-color: black;\">".$data_array[$i]."</span>";
}
elseif ($text == "Stream URL")
{
$datastring = "<a href=\"".$data_array[$i]."\" target=\"_blank\">".$data_array[$i]."</a>";
}
else
{
$datastring = $data_array[$i];
}
echo "<tr>\n <td>".$text.":</td>\n";
echo " <td>".$datastring."</td>\n</tr>\n";
}
}
else
{
echo "<tr>\n <td colspan=\"2\" style=\"color: red;\">".$data_array."</td>\n</tr>\n";
}
echo "</table>\n";
/*SONG HISTORY*/
echo "<h2>Song History</h2>\n";
echo $radio->getHistoryTable("/played.html", "<b>Played At</b>", "<b>Song</b>", "songOverview");
?>
</body>
</html>
- Ferik
- Posts: 11
- Joined: Thu 14th Jan, 2010 11:37 am
Re: last songs played
Customer Support: https://secure.bellonline.co.uk/submitticket.php
FreeStreamHosting Support: http://freestreamhosting.org/support.php
Sales: https://secure.bellonline.co.uk/contact.php
- Gavin
- Site Admin
- Posts: 346
- Joined: Thu 01st Jan, 1970 1:00 am
Re: last songs played
- Code: Select all
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>myRadio Test Page</title>
<style type="text/css">
.myRadio {
width:30%;
border:1px solid black;
background-color: #EEE;
}
.myRadio td {
padding: 1px 10px 1px 1px;
}
</style>
</head>
<body>
<?php
require_once ('shoutcast_class.php');
///YOUR RADIO CONFIGURATION IP & PORT///
$radio_ip = "stream_address_here";
$radio_port = "port_here";
$my_radio = new Radio($radio_ip.":".$radio_port);
/*SONG HISTORY*/
echo "<h2>Song History</h2>\n";
echo $my_radio->getHistoryTable("/played.html", "<b>Played At</b>", "<b>Song</b>", "myRadio");
?>
</body>
</html>
- Ferik
- Posts: 11
- Joined: Thu 14th Jan, 2010 11:37 am
Re: last songs played
I would like that same code, make some kind of script or the same code but I only extracted the Strem Genre and also to change the name of that variable, for example: instead of Stream Genre to display: PROGRAM:
Greetings and thanks.
- djboro88
- Posts: 3
- Joined: Wed 28th Apr, 2010 3:37 pm
Re: last songs played
- Code: Select all
<?php
$server_ip = "YOUR SERVER ADDRESS";
$portbase = "YOUR SERVER PORT";
if (!is_numeric($portbase)) {
print "Invalid port";
exit;
}
$fp = @fsockopen($server_ip,$portbase,$errno,$errstr,1);
if (!$fp) {
print "<p>Connection refused, the server appears to be offline.</p>";
exit;
} else {
fputs($fp, "GET /played.html HTTP/1.0\r\nUser-Agent: Mozilla\r\n\r\n");
while (!feof($fp)) {
$info = fgets($fp);
}
$content = get_string_between($info, "Admin Login</a></font></td></tr></table></td></tr></table><br>", "<br><br><table");
print $content;
fclose($fp);
}
function get_string_between($string, $start, $end) {
$string = " " . $string;
$ini = strpos($string, $start);
if ($ini == 0)
return "";
$ini += strlen($start);
$len = strpos($string, $end, $ini) - $ini;
return substr($string, $ini, $len);
}
?>
Customer Support: https://secure.bellonline.co.uk/submitticket.php
FreeStreamHosting Support: http://freestreamhosting.org/support.php
Sales: https://secure.bellonline.co.uk/contact.php
- Gavin
- Site Admin
- Posts: 346
- Joined: Thu 01st Jan, 1970 1:00 am
Re: last songs played
- mgajic
- Posts: 1
- Joined: Fri 10th Sep, 2010 5:54 pm
Re: last songs played
mgajic wrote:is there a way to get this list without PHP ... in simple html/java?
Unfortunately, there's a simple answer: No
You need some kind of server side language to process the data from the Shoutcast server.
Customer Support: https://secure.bellonline.co.uk/submitticket.php
FreeStreamHosting Support: http://freestreamhosting.org/support.php
Sales: https://secure.bellonline.co.uk/contact.php
- Gavin
- Site Admin
- Posts: 346
- Joined: Thu 01st Jan, 1970 1:00 am
Re: last songs played
Gavin wrote:Thanks for posting your script. Here's an alternative one that I made a few weeks ago which doesn't require the Shoutcast_class (which I'm getting a 'forbidden' error on when following the link).
My hosting provider had some problems which is why the 403 was issued. The problems have been resolved though and the website is back online. I've even posted a new, improved, version of the class containing new features:
http://devshed.excudo.net/scripts/php/s ... rnet+radio
Besides shoutcast, it can also retrieve and parse information from icecast and steamcast servers.
One of the new features is an improved way to exercise control over the output by means of a templating system.
Gavin wrote:You need some kind of server side language to process the data from the Shoutcast server.
Although i also think html+javascript won't work, the comment itself is not entirely true. A clientside language could also do the job. Javascript can do this, in theory, although most browsers will probably prevent it because they don't allow information from different domains to interact (but that's not a restriction of the language itself). But, for example, if you were to create an extension for firefox, this restriction wouldn't apply and i'm quite sure you would be able to load and parse the data (using a clientside language). Flash could be an option too, although the same restrictions might apply - i don't know cuz i'm not a flash expert.
- themarty
- Posts: 1
- Joined: Fri 24th Sep, 2010 1:56 pm
Return to Streaming Discussion
-
- Related topics
- Replies
- Views
- Last post
-
- Songs skip when fading to next track
by magpiie » Sun 02nd Jan, 2011 6:26 pm - 9 Replies
- 598 Views
- Last post by gayn01

Sat 09th Apr, 2011 5:41 pm
- Songs skip when fading to next track
Who is online
Users browsing this forum: No registered users and 1 guest

