egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

shoutcast.tcl, edit to show listeners from webpage code

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
Foekie_t
Voice


Joined: 17 Nov 2006
Posts: 7

PostPosted: Sun Dec 23, 2012 8:44 pm    Post subject: shoutcast.tcl, edit to show listeners from webpage code Reply with quote

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:
if {$oldcurlist != $repl} {
poststuff privmsg "  »» There are [lindex $repl 1] Listeners "
}}


Webpage CODE ( just add in html ):

Code:
<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 Wink.


Thanks and have a nice day.
Back to top
View user's profile Send private message
Madalin
Master


Joined: 24 Jun 2005
Posts: 310
Location: Constanta, Romania

PostPosted: Sun Jan 27, 2013 8:09 am    Post subject: Reply with quote

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.
_________________
https://github.com/MadaliNTCL - To chat with me: https://tawk.to/MadaliNTCL
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Sun Jan 27, 2013 11:38 am    Post subject: Reply with quote

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:
#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, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
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


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber