View previous topic :: View next topic |
Author |
Message |
Anonymous Guest
|
Posted: Tue Nov 06, 2007 10:41 pm Post subject: Online / Offline script? |
|
|
Is there an Online / Offline script that i can use to display on my website if the radio is streaming or not?? |
|
Back to top |
|
|
karlH Code Warrior
Joined: 13 Jun 2005 Posts: 5476 Location: UK
|
Posted: Wed Nov 07, 2007 3:39 pm Post subject: |
|
|
Your question is vague, because there are various ways you could achieve this so it depends on which way suits you. You could write your own xsl page for webroot that reports on whether a particular stream is up or down which you can then use to embed into a frame, you could keep a permanent setting somewhere which is changed when a stream is activated/deactivated and check this setting in something like php if generating a web page.
karl. |
|
Back to top |
|
|
Anonymous Guest
|
Posted: Fri Nov 09, 2007 8:08 am Post subject: various scripts - online/offline etc |
|
|
Hi there,
the thing with the scripts is that most of us are not programmers so we are unable to make our own scripts...
Because this is very a usefull feature (for us and for our webpage visitors to know who is on line streaming and who is not) maybe it should be a .xsl and a .php solution that really works designed by the developers officially.
In the new version of Icecast server maybe it should be bundled in...
I have tested some scripts that I have found in the forum pages but no luck
Best to all
Panos |
|
Back to top |
|
|
jcr Modérateur français
Joined: 14 Apr 2006 Posts: 544 Location: France, Auvergne
|
Posted: Fri Nov 09, 2007 8:27 am Post subject: Re: various scripts - online/offline etc |
|
|
There is a problem with such an embedded method, it would only fit needs of some users, not others.
There are so many ways using icecast, some with only 1 mount, others with quite a number of stations, mounts...
In posts in french and here, this subject aleady made long posts and whatever solutions, even with a small PHP module, didn't satisfy everyone. Say Joomla users would like a Joomla module, wich will not work with other CMSes, such as PhpNuke or PostNuke... Some kind of xls also was published and discussed, ie in this french topic.
[/url] _________________ Epsilon Friends Radio Icecast Radio on CentovaCast admin panel. Icecast hosting |
|
Back to top |
|
|
Anonymous Guest
|
Posted: Fri Nov 09, 2007 3:58 pm Post subject: |
|
|
xmmm this is what I need...
I did tried to use it but I had errors.
Can we make it work for simpe html pages that connect to an Icecast server and get some online stats?
If I had something like the getonline.php/getradiostats.xsl for my many mounts it would be great...
Maybe if we had a tool to select what stats to show and what not from a running Icecast server to simple html or php page.
If I was a programmer I could code it but I stopped programming 15 years ago (Pascal, Fortran, Basic - does anyone remember these languages anymore?)
Panos
This one works! just simpe on/offline for the server:
<?php
$host = '127.0.0.1'; // mettre l'ip de ta radio entre les apostrophes
$port = '8000'; //mettre le port de ta Radio entre les apostrophes (par defaut : 8000 )
function onlineIndicator($host ,$port){
$online=false;
$fp = @fsockopen($host, $port, $errno, $errstr, 1);
if($fp) {
$online=true;
}
if ($online){
return 'Radio server <span style="color:#00FF00"><b>Online</b></span>';
} else {
return 'Radio server <span style="color:#FF0000"><b>Offline</b></span>';
}
}
echo onlineIndicator($host,$port);
?> |
|
Back to top |
|
|
jcr Modérateur français
Joined: 14 Apr 2006 Posts: 544 Location: France, Auvergne
|
Posted: Fri Nov 09, 2007 6:43 pm Post subject: |
|
|
You just showed the Online status php function. Cited french topic shows something else. A xsl file (getradiostatus.xsl) you copy in web directory in icecast ans a php small module which uses this xsl.
As the status xsl returns all your mountpoints with all available info, PHP script can show whatever you want from those values.
This is used on http://www.flydance.eu/ site to show artist, tutle, current listeners and max listeners. Rhe script assumes a fallback mount for a playlist and names this ironically DJ Robot.
getradiostatus.xsl code:
Code: |
<xsl:stylesheet xmlns:xsl = "http://www.w3.org/1999/XSL/Transform" version = "1.0" >
<xsl:output omit-xml-declaration="no" method="xml" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" indent="yes" encoding="UTF-8" />
<xsl:template match = "/icestats" >
<pre>
MountPoint,Server Name,Description,Data Type,Bitrate,Quality,Video Quality,Frame Size,Frame Rate,Listeners,Peak Listeners,Genre,Server URL,Artist,Title
<xsl:for-each select="source">
<xsl:value-of select="@mount" />|<xsl:value-of select="server_name" />|<xsl:value-of select="server_description" />|<xsl:value-of select="server_type" />|<xsl:value-of select="bitrate" />|<xsl:value-of select="quality" />|<xsl:value-of select="video_quality" />|<xsl:value-of select="frame_size" />|<xsl:value-of select="frame_rate" />|<xsl:value-of select="listeners" />|<xsl:value-of select="listener_peak" />|<xsl:value-of select="genre" />|<xsl:value-of select="server_url" />|<xsl:value-of select="artist" />|<xsl:value-of select="title" />
_END_
</xsl:for-each>
</pre>
</xsl:template>
</xsl:stylesheet> |
And PHP code:
Code: |
<div>
<center><br>
<?php
// Don't allow direct acces to the file
// comment the defined below if not using mamboserver/Joomla...
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
// If not using Mambo/Joomla, set your values manually, as
// getParam is a Joomla function for modules.
$radioname = getParam( 'RadioStation' ) ;
$host = getParam( 'RadioHost' ) ;
$port = getParam( 'RadioPort' ) ;
$pic = getParam( 'RadioInfo' ) ;
$radioConnect = getParam( 'RadioStreamURI' ) ;
/**
* Lab Radio Module
*/
// if you don't have HTTP extension compiled in your PHP
// you might have to adapt next line, to grab page...
$msg = http_get( "http://$host:$port/getradiostatus.xsl" ) ;
$spl = explode( '<pre>', $msg ) ;
$spl = str_replace( '</pre>', '', $spl[1] ) ;
$spl = explode( "<br/>", $spl ) ;
$flds = $spl[0] ;
$spl = explode( "\n", $flds ) ;
array_shift( $spl ) ;
$stations = array() ;
foreach ( $spl as $e ) {
if ( ( $e !== '_END_' ) && !empty( $e ) ) {
$p = explode( '|', $e ) ;
$stations[$p[0]]['Name'] = $p[1] ;
$stations[$p[0]]['Description'] = $p[2] ;
$stations[$p[0]]['Listeners'] = $p[9] ;
$stations[$p[0]]['Peak'] = $p[10] ;
$stations[$p[0]]['Artist'] = $p[14] ;
$stations[$p[0]]['Title'] = $p[13] ;
}
}
//
$curtitle = $stations['/jrplay']['Title'] ;
$curartist = $stations['/jrplay']['Artist'] ;
$listeners = $stations['/jrplay']['Listeners'] ;
$peak = $stations['/jrplay']['Peak'] ;
$stream = 'DJ Robot' ;
echo '<a href="' . $radioConnect .'">' . $pic . '</a><br />' . "\n" ;
if ( !empty( $stations['/jrlive']['Name'] ) ) {
$curtitle = $stations['/jrlive']['Title'] ;
$curartist = $stations['/jrlive']['Artist'] ;
$listeners = $stations['/jrlive']['Listeners'] ;
$peak = $stations['/jrlive']['Peak'] ;
$stream = str_replace( 'on FlyDance', '', $stations['/jrlive']['Name'] ) ;
}
$curtitle = str_replace( '_', '', $curtitle ) ;
$curartist = str_replace( '_', '', $curartist ) ;
echo '<font size="+1"><strong>' . $listeners .'</strong></font> (' . $peak . ') auditeurs écoutent<br />' ;
echo "DJ: <strong>$stream</strong><br />" ;
echo "$curartist<br />" ;
?>
</center> <br/>
</div> |
_________________ Epsilon Friends Radio Icecast Radio on CentovaCast admin panel. Icecast hosting |
|
Back to top |
|
|
Anonymous Guest
|
Posted: Fri Nov 09, 2007 8:38 pm Post subject: php... lilte online xsl page tip |
|
|
Thank you jcr,
allthow I didn't managed to work it out
(Fatal error: Call to undefined function http_get() in C:\Program Files\xampp\htdocs\test1\online2.php on line 19
---> // if you don't have HTTP extension compiled in your PHP
// you might have to adapt next line, to grab page...
$msg = http_get( "http://192.168.0.121:8000/getradiostatus.xsl/" ) ;///// I have XAMPP latest windows version installed)
I'm getting the grip of it...!
I'm posting here something simpla that I have made, this may be useful for other people to!
Panos
I'm calling this page from a standard html so I have my online directory inside a table/frame.
I have this file named status3.xsl saved in /web of Icecast server.
<xsl:stylesheet xmlns:xsl = "http://www.w3.org/1999/XSL/Transform" version = "1.0" >
<xsl:output omit-xml-declaration="no" method="xml" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" indent="yes" encoding="UTF-8" />
<xsl:template match = "/icestats" >
<pre>
Online Radios
<xsl:for-each select="source">
<xsl:value-of select="@mount" />,<a href="{@mount}.m3u"> Listen here</a>, Listeners <xsl:value-of select="listeners" />, Web Pages <a target="_blank" href="{server_url}"><xsl:value-of select="server_url" /><br /></a>
</xsl:for-each>
</pre>
</xsl:template>
</xsl:stylesheet> |
|
Back to top |
|
|
Go_Go
Joined: 23 Jan 2010 Posts: 5
|
Posted: Sat Jan 23, 2010 7:51 pm Post subject: |
|
|
Hello
I want to install this to me, come not entirely clear. these are my data server.
IP: 89.11.*.*
Port: 12000
User: Gogo
Pass: hhhhh
Code: |
$radioname = getParam( 'what should I enter here' ) ;
$host = getParam( 'what should I enter here' ) ;
$port = getParam( 'what should I enter here' ) ;
$pic = getParam( 'what should I enter here' ) ;
$radioConnect = getParam( 'what should I enter here' ) ; |
Helpme Pls |
|
Back to top |
|
|
jcr Modérateur français
Joined: 14 Apr 2006 Posts: 544 Location: France, Auvergne
|
Posted: Sat Jan 23, 2010 8:22 pm Post subject: |
|
|
Well, this is a really old post resurected...
Cod ecame from a Joomla module..
As said, replace getParam() with:
Code: |
$radioname = getParam( 'RadioStation' ) ; // Your station Name
$host = getParam( 'RadioHost' ) ; // your station hostname ie myradio.mydomain.com
$port = getParam( 'RadioPort' ) ; // icecast port ie 8000
$pic = getParam( 'RadioInfo' ) ; /// Here original module has a clickable icon to a popuup player
$radioConnect = getParam( 'RadioStreamURI' ) ; // stream uri http://myradio.mydomain.com
|
What also could be blocking is calling http_get to grab information. If your PHP install does not have this extension, you cal install it (http://pecl.php.net) or use another way to grab xsl result. _________________ Epsilon Friends Radio Icecast Radio on CentovaCast admin panel. Icecast hosting |
|
Back to top |
|
|
Go_Go
Joined: 23 Jan 2010 Posts: 5
|
Posted: Sat Jan 23, 2010 9:00 pm Post subject: |
|
|
yes it is old, but I wanted to open a new topic in does not work
Code: |
Fatal error: Call to undefined function getParam() in /var/www/vhosts/mysite.de/httpdocs/radyo.php on line 8
|
Code: |
<div>
<center><br>
<?php
// Don't allow direct acces to the file
// comment the defined below if not using mamboserver/Joomla...
// If not using Mambo/Joomla, set your values manually, as
// getParam is a Joomla function for modules.
$radioname = getParam( 'gogo' ) ;
$host = getParam( 'http://mysite.de/' ) ;
$port = getParam( '12000' ) ;
$pic = getParam( 'http://mysite.de/' ) ;
$radioConnect = getParam( 'http://mysite.de/' ) ;
/**
* Lab Radio Module
*/
// if you don't have HTTP extension compiled in your PHP
// you might have to adapt next line, to grab page...
$msg = http_get( "http://$host:$port/radyo.xsl" ) ;
$spl = explode( '<pre>', $msg ) ;
$spl = str_replace( '</pre>', '', $spl[1] ) ;
$spl = explode( "<br/>", $spl ) ;
$flds = $spl[0] ;
$spl = explode( "\n", $flds ) ;
array_shift( $spl ) ;
$stations = array() ;
foreach ( $spl as $e ) {
if ( ( $e !== '_END_' ) && !empty( $e ) ) {
$p = explode( '|', $e ) ;
$stations[$p[0]]['Name'] = $p[1] ;
$stations[$p[0]]['Description'] = $p[2] ;
$stations[$p[0]]['Listeners'] = $p[9] ;
$stations[$p[0]]['Peak'] = $p[10] ;
$stations[$p[0]]['Artist'] = $p[14] ;
$stations[$p[0]]['Title'] = $p[13] ;
}
}
//
$curtitle = $stations['/jrplay']['Title'] ;
$curartist = $stations['/jrplay']['Artist'] ;
$listeners = $stations['/jrplay']['Listeners'] ;
$peak = $stations['/jrplay']['Peak'] ;
$stream = 'DJ Robot' ;
echo '<a href="' . $radioConnect .'">' . $pic . '</a><br />' . "\n" ;
if ( !empty( $stations['/jrlive']['Name'] ) ) {
$curtitle = $stations['/jrlive']['Title'] ;
$curartist = $stations['/jrlive']['Artist'] ;
$listeners = $stations['/jrlive']['Listeners'] ;
$peak = $stations['/jrlive']['Peak'] ;
$stream = str_replace( 'on FlyDance', '', $stations['/jrlive']['Name'] ) ;
}
$curtitle = str_replace( '_', '', $curtitle ) ;
$curartist = str_replace( '_', '', $curartist ) ;
echo '<font size="+1"><strong>' . $listeners .'</strong></font> (' . $peak . ') auditeurs écoutent<br />' ;
echo "DJ: <strong>$stream</strong><br />" ;
echo "$curartist<br />" ;
?>
</center> <br/>
</div>
|
|
|
Back to top |
|
|
jcr Modérateur français
Joined: 14 Apr 2006 Posts: 544 Location: France, Auvergne
|
Posted: Sat Jan 23, 2010 11:49 pm Post subject: |
|
|
gatParam() is a pure Joomla API function.
Code: |
$radioname = 'gogo' ;
$host = 'http://mysite.de/' ;
$port = 12000 ;
$pic = 'http://mysite.de/' ;
$radioConnect = 'http://mysite.de/' ;
|
If php complains about http_get, look on pecl.php.net fort php_http extension, or rewrite using curl or fopen. _________________ Epsilon Friends Radio Icecast Radio on CentovaCast admin panel. Icecast hosting |
|
Back to top |
|
|
Go_Go
Joined: 23 Jan 2010 Posts: 5
|
Posted: Sun Jan 24, 2010 8:04 am Post subject: |
|
|
I Have upload this radyo.xsl
OF
/etc/icecast2/web/radyo.xsl
Is coreckt?
I have chance
Code: |
$radioname = 'gogo' ;
$host = 'http://mysite.de/' ;
$port = 12000 ;
$pic = 'http://mysite.de/' ;
$radioConnect = 'http://mysite.de/' ; |
Code: |
Fatal error: Call to undefined function php_http() in /var/www/vhosts/mysite.de/httpdocs/radyo.php on line 20 |
line 20 is
Code: |
$msg = http_get( "http://$host:$port/radyo.xsl" ) ; |
I have chance this
Code: |
$msg = fopen ( "http://$host:$port/radyo.xsl" ) ; |
Error
Code: |
Warning: fopen() expects at least 2 parameters, 1 given in /var/www/vhosts/mysite.de/httpdocs/radyo.php on line 20
http://mysite.de/
() auditeurs écoutent
DJ: DJ Go Go |
|
|
Back to top |
|
|
jcr Modérateur français
Joined: 14 Apr 2006 Posts: 544 Location: France, Auvergne
|
Posted: Sun Jan 24, 2010 9:27 am Post subject: |
|
|
To adapt PHP scripts, ypu shoulf at least read documentation about functions. _________________ Epsilon Friends Radio Icecast Radio on CentovaCast admin panel. Icecast hosting |
|
Back to top |
|
|
Go_Go
Joined: 23 Jan 2010 Posts: 5
|
Posted: Sun Jan 24, 2010 10:29 am Post subject: |
|
|
Sorry I know nothing !!
Can they produce a demo |
|
Back to top |
|
|
jcr Modérateur français
Joined: 14 Apr 2006 Posts: 544 Location: France, Auvergne
|
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2002 phpBB Group subRebel style by ktauber
|