Icecast Streaming Media Server Forum Index Icecast Streaming Media Server
Icecast is a Xiph Foundation Project
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Show number of listeners on website?

 
Post new topic   Reply to topic    Icecast Streaming Media Server Forum Index -> Icecast Server
View previous topic :: View next topic  
Author Message
tunevibez



Joined: 21 Feb 2010
Posts: 9

PostPosted: Sun Feb 28, 2010 2:30 am    Post subject: Show number of listeners on website? Reply with quote

What code would I need to do this?
Back to top
View user's profile Send private message
karlH
Code Warrior
Code Warrior


Joined: 13 Jun 2005
Posts: 5476
Location: UK

PostPosted: Sun Feb 28, 2010 3:43 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
tunevibez



Joined: 21 Feb 2010
Posts: 9

PostPosted: Sun Feb 28, 2010 3:46 am    Post subject: Reply with quote

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
View user's profile Send private message
iunderwood



Joined: 23 Aug 2008
Posts: 114
Location: Leicester, MA

PostPosted: Sun Feb 28, 2010 4:05 am    Post subject: Reply with quote

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
View user's profile Send private message
tunevibez



Joined: 21 Feb 2010
Posts: 9

PostPosted: Sun Feb 28, 2010 4:07 am    Post subject: Reply with quote

I would like to fetch the number of listeners from one mountpoint /tunevibez
Back to top
View user's profile Send private message
karlH
Code Warrior
Code Warrior


Joined: 13 Jun 2005
Posts: 5476
Location: UK

PostPosted: Sun Feb 28, 2010 4:56 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
tunevibez



Joined: 21 Feb 2010
Posts: 9

PostPosted: Sun Feb 28, 2010 1:28 pm    Post subject: Reply with quote

So I put that in the webroot of the server?
Back to top
View user's profile Send private message
karlH
Code Warrior
Code Warrior


Joined: 13 Jun 2005
Posts: 5476
Location: UK

PostPosted: Sun Feb 28, 2010 1:45 pm    Post subject: Reply with quote

yes, like the other xsl files like status.xsl and status2.xsl

karl.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Dave18



Joined: 26 Jan 2010
Posts: 20

PostPosted: Sat Sep 25, 2010 2:15 pm    Post subject: Reply with quote

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
View user's profile Send private message
karlH
Code Warrior
Code Warrior


Joined: 13 Jun 2005
Posts: 5476
Location: UK

PostPosted: Sat Sep 25, 2010 3:15 pm    Post subject: Reply with quote

2.3.1 did not have the mount filter support.

karl.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Icecast Streaming Media Server Forum Index -> Icecast Server All times are GMT
Page 1 of 1

 
Jump to:  
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