| View previous topic :: View next topic |
| Author |
Message |
MHz
Joined: 29 Jun 2008 Posts: 16
|
Posted: Sun Sep 07, 2008 9:50 am Post subject: PHP Playlist |
|
|
Hi all,
I was wondering if it is possible to create a playlist in PHP of all the songs played/currently playing/recently played, if yes, how do I do that? I searched the forum, but I couldnt find anything usefull
Thanks in advance |
|
| Back to top |
|
 |
karlH Code Warrior

Joined: 13 Jun 2005 Posts: 5476 Location: UK
|
Posted: Sun Sep 07, 2008 2:53 pm Post subject: |
|
|
If you cannot retrieve the information from the source client then you could try to get the information from the icecast playlist log.
karl. |
|
| Back to top |
|
 |
MHz
Joined: 29 Jun 2008 Posts: 16
|
Posted: Mon Sep 08, 2008 5:50 pm Post subject: |
|
|
Thanks, but then I get an entry like
| Quote: |
| 8/Sep/2008:19:41:26 +0200|/mainstream|0|Cascada - Everytime We Touch |
I want it to be like this:
| Quote: |
| 8/Sep/2008:19:41:26 ATRIST - SONG |
Or, if possible, like
| Quote: |
| 19:41:26 ARTIST - SONG |
[/code] |
|
| Back to top |
|
 |
karlH Code Warrior

Joined: 13 Jun 2005 Posts: 5476 Location: UK
|
Posted: Mon Sep 08, 2008 6:16 pm Post subject: |
|
|
nobody is stopping you from converting the layout, we just provide the information, how you present it is completely up to you.
karl. |
|
| Back to top |
|
 |
MHz
Joined: 29 Jun 2008 Posts: 16
|
Posted: Tue Sep 09, 2008 12:45 pm Post subject: |
|
|
| How can I change it then, do you have an example code? |
|
| Back to top |
|
 |
jcr Modérateur français

Joined: 14 Apr 2006 Posts: 544 Location: France, Auvergne
|
Posted: Fri Sep 12, 2008 1:53 pm Post subject: |
|
|
| MHz wrote: |
| Quote: |
| 8/Sep/2008:19:41:26 +0200|/mainstream|0|Cascada - Everytime We Touch |
I want it to be like this:
| Quote: |
| 8/Sep/2008:19:41:26 ATRIST - SONG |
Or, if possible, like
| Quote: |
| 19:41:26 ARTIST - SONG |
|
From PHP, nothing prevents you from reformating strings.
ie:
| Code: |
$ar = explode( '|', $line ) ;
// Now you get an array with (using your sample):
// $ar[0] => '8/Sep/2008:19:41:26'
// $ar[1] => '/mainstream'
// $ar[2] => '0'
// $ar[3] => 'Cascada - Everytime We Touch'
//
// Now you can use this like you want
// ie:
$dt = explode( ':', $ar[0] ;
$re = implode( ':', array_shift( $dt ) ) . ' ' . $ar[3];
|
Or whatever else you need to format results. _________________ Epsilon Friends Radio Icecast Radio on CentovaCast admin panel. Icecast hosting |
|
| Back to top |
|
 |
author
Joined: 26 Dec 2008 Posts: 2 Location: Alexander NC
|
Posted: Tue Dec 30, 2008 3:02 pm Post subject: |
|
|
This gives me a nice 'cleaned up' list from a playlist:
| Code: |
$lines = file('/home/ralph/mp3/oldtimey/playlist_old.m3u');
$num = count($lines);
echo '<table border=1 class="sample" align=right><tr bgcolor=Goldenrod><td><b>Playlist - ' . $num. ' files</td></tr>
';
$i=0;
while ($i < $num + 1) {
echo '<tr><td>';
$temp = str_replace("_"," ",$lines[$i]);
$temp = str_replace("Blue","",$temp);
$temp = str_replace(".mp3","",$temp);
echo $temp;
echo '</td></tr>';
$i = $i + 1;
}
echo '</table><br><br>';
|
--Ralph[/code] _________________ --Ralph Roberts
http://skyfest.net, http://1vid.com, http://abooks.com |
|
| Back to top |
|
 |
|