| View previous topic :: View next topic |
| Author |
Message |
tunevibez
Joined: 21 Feb 2010 Posts: 9
|
Posted: Sun Feb 28, 2010 2:30 am Post subject: Show number of listeners on website? |
|
|
| What code would I need to do this? |
|
| Back to top |
|
 |
karlH Code Warrior

Joined: 13 Jun 2005 Posts: 5476 Location: UK
|
Posted: Sun Feb 28, 2010 3:43 am Post subject: |
|
|
vague question, you don't specify how you want to pass that data from icecast. the icecast xsl pages can show the listener counts for all streams but how do you want to get that to your website? php backend query, iframe or is this web page served from icecast, one particular stream?, all streams?
karl |
|
| Back to top |
|
 |
tunevibez
Joined: 21 Feb 2010 Posts: 9
|
Posted: Sun Feb 28, 2010 3:46 am Post subject: |
|
|
| Not a vague question, I have a website on the internet, in this case http://tunevibez.com and I would like to display the number of listeners that are listening to the station. NOT by making an iframe. |
|
| Back to top |
|
 |
iunderwood

Joined: 23 Aug 2008 Posts: 114 Location: Leicester, MA
|
Posted: Sun Feb 28, 2010 4:05 am Post subject: |
|
|
Depending on how you want to set it up and what kind of ease-of-use you're looking for, it could take quite a bit of code.
If you're grabbing one mountpoint and extracting a number from it, you can use a fetch to grab the XML, the pull out the mountpoint, and further pull out the listener count. It could be done in a dozen or so PHP lines.
However, if you have multiple mountpoints and multiple servers, there isn't a single piece of simple code that exists.
If you don't want to use an IFrame, then it gets tricky. You either need to use an AJAX element to pull the listener count from somewhere, or the server needs to know how to query and process the mountpoint info.
I wrote a XOOPS module which does pretty much what you're looking for, and you're welcome to download it and see how it works for you at http://xoops.underowod-hq.org in the download section. It displays the Radio block here: http://www.powerfrag.fm _________________ ++I; |
|
| Back to top |
|
 |
tunevibez
Joined: 21 Feb 2010 Posts: 9
|
Posted: Sun Feb 28, 2010 4:07 am Post subject: |
|
|
| I would like to fetch the number of listeners from one mountpoint /tunevibez |
|
| Back to top |
|
 |
karlH Code Warrior

Joined: 13 Jun 2005 Posts: 5476 Location: UK
|
Posted: Sun Feb 28, 2010 4:56 am Post subject: |
|
|
maybe you want to start off simple, try an adding an xsl file in webroot like
| Code: |
<xsl:stylesheet xmlns:xsl = "http://www.w3.org/1999/XSL/Transform" version = "1.0" >
<xsl:output method="text" media-type="text/plain" indent="yes" encoding="UTF-8" />
<xsl:template match = "/icestats" >
<xsl:for-each select="source">
<xsl:value-of select="@mount" />,<xsl:value-of select="listeners" /><xsl:text>
</xsl:text>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
|
you can then use http://host:8000/my.xsl?mount=/tunevibez
you can even remove the <xsl:value-of select="@mount" />, to give you just the number and nothing else
karl. |
|
| Back to top |
|
 |
tunevibez
Joined: 21 Feb 2010 Posts: 9
|
Posted: Sun Feb 28, 2010 1:28 pm Post subject: |
|
|
| So I put that in the webroot of the server? |
|
| Back to top |
|
 |
karlH Code Warrior

Joined: 13 Jun 2005 Posts: 5476 Location: UK
|
Posted: Sun Feb 28, 2010 1:45 pm Post subject: |
|
|
yes, like the other xsl files like status.xsl and status2.xsl
karl. |
|
| Back to top |
|
 |
Dave18
Joined: 26 Jan 2010 Posts: 20
|
Posted: Sat Sep 25, 2010 2:15 pm Post subject: |
|
|
Hi Karl,
I've just tried the xsl file to get the listeners and it works great on 2.3.2 server.
But if I use it on a 2.3.1 version I always get the full list of the mount points and their listeners even if I put in the url the mount point name.
Pratically I have the same result with both urls:
http://myserver:8000/my.xsl?mount=/demo
http://myserver:8000/my.xsl
I always see the complete list of the mount points.
Is it a limit of 2.3.1 version?
thanks!
Dave |
|
| Back to top |
|
 |
karlH Code Warrior

Joined: 13 Jun 2005 Posts: 5476 Location: UK
|
Posted: Sat Sep 25, 2010 3:15 pm Post subject: |
|
|
2.3.1 did not have the mount filter support.
karl. |
|
| Back to top |
|
 |
|