Top

Shoutcast Stream Bot


mIRC Code
+ 1 likes
Please Register to submit score.
Bookmark and Share
Average Score  4.4 (of 5 scores)
Date Added  Sep 17, 2008
Last Updated  Sep 17, 2008
Tags  bot  shoutcast  sockets  stream 

Description

This isn't my snippet, but due to an extreme lack of seeing this type of snippet out there, I'm posting my friend Talon's snippet.

It's just a snippet for a bot, say if you have a shoutcast server, that'll query the server, and announce the song.

Grab the Code

;#########################################
; Modify User/Pass/Host/Port then use
; "/cshout" to connect and fill hash table
; YOU WILL GET * Line too long: $+ ERRORS!
; what can i say, im lazy and mIRC SUX!
;#########################################
alias ShoutData { 
  if ($isid) {
    if ($1 = user) { return ***** }
    if ($1 = pass) { return ***** }
    if ($1 = host) { return ***** }
    if ($1 = port) { return ***** }
    if ($1 = Accept) { return CURRENTLISTENERS;PEAKLISTENERS;MAXLISTENERS;REPORTEDLISTENERS;AVERAGETIME;SERVERGENRE;SERVERURL;SERVERTITLE;SONGTITLE;SONGURL;IRC;ICQ;AIM;WEBHITS;STREAMHITS;STREAMSTATUS;BITRATE;CONTENT;VERSION;INDEX;LISTEN;PALM7;LOGIN;LOGINFAIL;PLAYED;ADMIN;UPDINFO }
  }
}
;#########################################
; $ShoutInfo(<data>) Improper use of this
; alias will return all possible choices
; Just look at the Accept in ShoutData
;#########################################
alias ShoutInfo {
  if ($istok($shoutdata(accept),$1,59)) { return $hget(ShoutInfo,$1) }
  else { return *** Improper Usage: use one of the following: $shoutdata(accept) }
}
alias SShout { sockwrite -n $1- }
alias CShout { hfree -w ShoutInfo | sockopen ShoutCast $ShoutData(host) $ShoutData(port) }
on *:sockclose:ShoutCast: { 
  echo -a Closed Scoket?
}
on *:sockopen:ShoutCast: {
  if ($sockerr > 0) { sockclose $sockname | return }
  else {
    SShout $sockname GET /admin.cgi?mode=viewxml HTTP/1.1
    SShout $sockname Authorization: Basic $encode($+($ShoutData(user),:,$ShoutData(pass)),m)
    SShout $sockname Referer: $+(http://,$ShoutData(host),:,$ShoutData(port))
    SShout $sockname User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322)
    SShout $sockname Host: $+($ShoutData(host),:,$ShoutData(port))
    SShout $sockname Connection: Keep-Alive $+ $str($crlf,2)
  }
}
on *:sockread:ShoutCast: {
  if ($sockerr > 0) return
  :nextread | sockread -f %temp
  if ($sockbr == 0) return
 
  var %match = $regsub(%temp,/^HTTP\/1\.0 200 OK/g,$null,%temp)
  var %match = $regsub(%temp,/^Content\-Type\:text\/xml/g,$null,%temp)
 
  var %MaxLen = 900 | dec %MaxLen $len(%BackBuffer)
  var %Srch = $+(%BackBuffer,$mid(%temp,1,%MaxLen))
  inc %MaxLen | var %BackBuffer = $mid(%temp,%MaxLen)
 
  var %match = $regex(ShoutData,%Srch,/<(\w+?)>(.*?)<\/\1?>/msg)
  var %x = 0 , %y = 1 | while (%x < %match) { inc %x
    if ($istok($shoutdata(accept),$regml(ShoutData,%y),59)) { hadd -m ShoutInfo $regml(ShoutData,%y) $regml(ShoutData,$calc(%y + 1)) }
    inc %y 2
  }
  %match = $regsub(%temp,/<(\w+?)>.*?<\/\1?>/g,$null,%temp)
  if (%temp) { 
    var %match = $regsub(%temp,/<\?[^>]>/g,$null,%temp)
    var %match = $regsub(%temp,/<\![^>]>/g,$null,%temp)
    %BackBuffer = $+(%BackBuffer,%temp)
  }
  goto nextread
}
 

Comments

  (4)  RSS
AdrianF
Comments: 53
 
mIRC Snippet:  Shoutcast Stream Bot
Posted on Nov 6, 2008 7:15 am
cool
^Neptune
Comments: 629
 
mIRC Snippet:  Shoutcast Stream Bot
Posted on Nov 6, 2008 10:27 am
Doesn't work for me, and I have changed the port, host and password. I also edited user to Neptune, as I have no clue what that is supposed to be.

Everything returns: "* /echo: insufficient parameters".

Are you supposed to use this on a computer that hosts the radio itself? Because that's exactly what I'm doing here, and is suggested by the password bit.
Dangus
Comments: 4
 
mIRC Snippet:  Shoutcast Stream Bot
Posted on Mar 6, 2009 5:48 pm
i need this script or similar script. Can anyone tell me how to install it to mirc? step by step? please :) im just started use mirc and i have no clue how it works and what i can to do to make scripts work on it. Please, if anyone spare a few minutes explain to me how do that, please please please :) :)
RicJames
Comments: 27
 
mIRC Snippet:  Shoutcast Stream Bot
Posted on Jun 15, 2009 5:24 am
i keep getting this error Closed Scoket?

Commenting Options

Register or Login to Hawkee.com or use your Facebook or Twitter account by clicking the corresponding button below.

  

Bottom