mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
This topic was originally started here , however, due to the amount of time that has passed since the last post, I'm wondering if maybe my request and that of the person that did attempt this exceeds the knowledge of those on Hawkee, so I'm turning here for, hopefully, a resolution.
If a resolution is found, I will post it on the Hawkee site as well.

For those of you that prefer to not look at that topic without some idea as to what I'm looking for, here goes:

I'm looking for a socket code that will return specific information to a dialog with automatic updates.
The site can change, as it will be related to the site for the specific radio station, however, the headings on the site for the information will remain constant.
These sites are ShoutCast sites, if that makes a difference.
As a starting/testing point, you can use one or more of the following sites
http://s5.viastreaming.net:7420
http://s5.viastreaming.net:7910
http://208.53.148.251:8000
To be more specific, I want to get the following information (all of which is returned beside one of those items mentioned)
1) If the server is up or not
2) If the server is public or not
3) If the stream is up or not
4) The broadcast speed of the stream (if the stream is up)
5) The current number of listeners
6) Maximum number of listeners
7) Listener Peak
8) Stream Title (usually the DJ's nick)
9) Current Song Title

If the information isn't available, then the code should return N/A

I've tried everything I can think of and then even went in search of complicated sockets to look for ideas I didn't try yet and tried those too. This thing does not want to cooperate.

The purpose of this message is to ask other people for some help. I'm using a test socket to throw the info to the status window and looking at it there to see what I can see. Keep in mind that using the url that we were linked to above that still works which is http://208.53.148.251:8000 it will send the

Quote:
ICY 200 OK
icy-notice1:<BR>This stream requires <a href="http://www.winamp.com/">Winamp</a><BR>
icy-notice2:SHOUTcast Distributed Network Audio Server/Linux v1.9.8<BR>
icy-name:SA Radio: DJ^RusselB
icy-genre:Various
icy-url:http://www.audiorealm.com
content-type:audio/mpeg
icy-pub:1
icy-br:128

and then immediately start the audio stream which youll recognize as your standard programming garble.

The problem is it isn't sending the page that we see when we click the link in IE or FireFox. The source is completely different. If we can get the source we need sent to mirc with the socket (the source that you look at in IE when clicking View, Source) then everything else shouldn't be a problem at all. Its getting that particular information, all of it, thats killing me.

Every single time I tried to grab any of the pages from the url independantly such as /index.html or /played.html I would get a bad request error. If you try not using port 8000 you hit a fat dead end too.
The code I'm using to test right now is:
Code:
alias testshout {
  sockopen shout 208.53.148.251 8000
  timer -m 1 500 sockclose shout
}
on *:sockopen:shout:{
  sockwrite -n $sockname GET / HTTP/1.1
  sockwrite -n $sockname Host: 208.53.148.251:8000 $+ $crlf $+ $crlf
}
on *:sockread:shout:{
  if ($sockerr) { return }
  sockread %testshout
  if ($sockbr == 0) { return }
  if (%testshout != $null) { echo -s %testshout }
}
on *:sockclose:shout:{ unset %temptestshout }
;The following alias is not mine.  I am unsure of its original author.
alias htmlfree {
  var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x,&nbsp;)
  return %x
}

Notice I have a timer kill the socket. I added this as a convience to anyone who wants to try and help, personally I was just following the /testshout with a /sockclose shout in the edit box to stop it so I could kill it when I wanted to but after the first time it ended up being within a second or two every time because the garble in the audio stream never ends and has no usable code in it.
The timer is set to 500 miliseconds and allows for about a page of information to be sent to the status window before killing the socket.

I also included the htmlfree alias since its almost always needed when processing sockets even tho in this case I haven't needed it yet. It's just something I include in a socket Im working on out of habbit.

I'll keep looking for ideas but any input would be appreciated.


My thanks to Typo on Hawkee for his help so far, and my thanks in advance to any/everyone that can assist with this.

Joined: Dec 2002
Posts: 2,962
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
Looks like the server response varies based on whether you provide a user agent.

Add something like sockwrite -n $sockname User-Agent: Mozilla/5.0 (compatible; Windows) to your HTTP request and you should be fine.


Spelling mistakes, grammatical errors, and stupid comments are intentional.

Link Copied to Clipboard