last songs played

Discuss Shoutcast streaming here, any issues, advice or tips are welcome

last songs played

Postby prideplay » Wed 20th Jan, 2010 6:41 am

Hiya
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

Postby Ferik » Thu 21st Jan, 2010 2:26 pm

PHP Shoutcast Class with example :D http://devshed.excudo.net/scripts/php/s ... cast+class

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: 10
Joined: Thu 14th Jan, 2010 11:37 am

Re: last songs played

Postby Gavin » Thu 21st Jan, 2010 2:55 pm

That looks like a decent script, thanks for posting 8)
Please don't PM me for support as you will not get a timely response, use the proper support system located at http://secure.bellonline.co.uk/submitticket.php
Gavin
Site Admin
 
Posts: 139
Joined: Thu 01st Jan, 1970 1:00 am

Re: last songs played

Postby Ferik » Thu 21st Jan, 2010 5:33 pm

if you want History Song only, this is the code, remember to download the shoutcast class ........ very simple :)

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: 10
Joined: Thu 14th Jan, 2010 11:37 am


Return to Streaming Discussion

Who is online

Users browsing this forum: No registered users and 1 guest


Website Navigation

For Your Information

Service Updates

Service Status & Stats

Knowledgebase

Community Forums

Contact Details

Sales and General Enquiries

Support Centre

Our Services

MixStream.net
Media streaming services

UKHostingDirect.com
Shared and reseller hosting

LowCostDedi.net
Value dedicated servers

Cast-Control-LITE.net
Licenses from just £2.70

Legal Information

Any personal information we collect on this page will be treated in accordance with our privacy policy.
By viewing this website, you agree to the Website Terms of Use.

Copyright © 2010 Bell Online Ltd. Registered in England & Wales 7234972. W3C Valid - HTML

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

phpBB SEO