This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

shoutcast.tcl, edit to show listeners from webpage code

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
F
Foekie_t
Voice
Posts: 7
Joined: Fri Nov 17, 2006 8:11 pm

shoutcast.tcl, edit to show listeners from webpage code

Post by Foekie_t »

Hi,

I have a shoutcast server, but also a flashserver for my radio. Just as a hobby... The users for the shoutcast server, I can get with the shoutcast.tcl, like always. But now that I have the flashserver, I am not able to show the current listeners of that flashserver in the irc channel, which I would love to show... I have a code to get the listeners, but it's html, so I don't know how to add this to the tcl, to show the correct number in total en also seperate...

Like: Total Listeners: 50 ( Winamp: 25 ; Flash: 25 )

See below the code, that is showing my listerners on a webpage. How can I get the users that are showing on this page also in the number of the shoutcast.tcl ??

Shoutcast.tcl

Code: Select all

if {$oldcurlist != $repl} {
poststuff privmsg "  »» There are [lindex $repl 1] Listeners "
}}
Webpage CODE ( just add in html ):

Code: Select all

<script type="text/javascript" src="http://media.streamingpulse.biz:2000/system/misc/scripts/streaminformation.js.php?id=42"></script>

<table border="1" width="250">
	<tr>
		<th><script>document.write(StreamInformation.SONGTITLE())</script></th>
	</tr>
	<tr>
		<td align="center">
			<script>document.write(StreamInformation.CURRENTLISTENERS() +"/"+ StreamInformation.MAXLISTENERS() +" Listeners @ "+ StreamInformation.BITRATE() +"Kbps")</script>
		</td>
	</tr>
</table>
Hope that someone can help me with this ;).


Thanks and have a nice day.
User avatar
Madalin
Master
Posts: 310
Joined: Fri Jun 24, 2005 11:36 am
Location: Constanta, Romania
Contact:

Post by Madalin »

Please tell us the direct tlink from that working page. We need to see the exact url path and its source code. The simple the page is like:

34 listeners
named radio station

The easier is it for us to make the request.
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

I had a quick look at the page-info. Unfortunately, the JS-datasource provides that information as javascript functions, rather than simple variables. That makes automated parsing alittle harder than simply unpacking a JSON blob. Ideally, you'd use something like spidermonkey or rhino for the parsing, though I havn't tried linking eggdrop with spidermonkey to this day.

You could extract the data with some creative regular expressions;

Code: Select all

#Assuming we've already fetched http://media.streamingpulse.biz:2000/system/misc/scripts/streaminformation.js.php?id=42
#and stored the content in $data

set idx [regexp -inline -indices -- {\.CURRENTLISTENERS} $data]
regexp -start [lindex $idx 1] -- {return "([0-9]+)";} $data match listeners

#number of listeners is now stored in $listeners
#this will not check that streamStatus is true however...
NML_375
Post Reply