Jump to content

Icecast Last 12 Tracks


dustyfoo

Recommended Posts

I am using php to show last 12 tracks what were played on a radio station, the existing script works, however, I need to modify it so it only shows last 12 results from lines what contain '/stream':

 

example of playlist.log

 

01/May/2015:11:45:44 +0000|/live|0|Dense & Pika - Black Deep
01/May/2015:11:45:44 +0000|/stream|11|Dense & Pika - Black Deep
01/May/2015:11:45:48 +0000|/stream|11|DJ Mays - Big Room Session Mix (#111,112 TRTM)
01/May/2015:11:46:00 +0000|/live|0|Dense & Pika - Black Deep
01/May/2015:11:46:00 +0000|/stream|11|Dense & Pika - Black Deep
01/May/2015:11:46:05 +0000|/stream|11|DJ Mays - Big Room Session Mix (#111,112 TRTM)
 

 

here is the existing script:

 

http://dpaste.com/05XYG7G.txt

 

 

Hope you can help :)

Link to comment
Share on other sites

Try changing these lines

while (! feof($fp)) {
        $parts = fgetcsv($fp, 0, '|');
        echo fgets($page). "<br />";
        if (count($parts) !== 4) {
                continue;
        }

to

while (($parts = fgetcsv($fp, 0, '|'))  !== FALSE)
{
        if ((count($parts) != 4) || (strpos($parts[1], '/stream') === false)) {
                continue;
        }
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.