Bot For GameNerveRadio
Posted by VirusX
Sunday, August 28, 2005
Description: Simple Multiple Server Shoutcast, Correct any mistakes I had/have please. Basicly make sure you add %radiochan to your variables and %stream1.host %stream1.port also for #2, %stream2.host and %steam2.port. I think thats about all. You need to edit all the skinning yourself etc. etc. Known Bugs! The @servers area is incomplete, check it out and fix it if you please!
##########################
# Radio Bot By VirusX #
##########################
#Topic Management
alias dotopic {
topic %radiochan RadioName :: 1: %dj1 :: 2: %dj2
}
on *:TEXT:@refresh:%radiochan:{
if ($nick isop %radiochan) { dotopic }
else {halt}
}
#ONAIR/OFFAIR
on *:TEXT:@onair1:%radiochan:{
if ($nick isop %radiochan) { set %dj1 $nick | dotopic }
else { notice $nick You do not have access to this command }
}
on *:TEXT:@onair2:%radiochan:{
if ($nick isop %radiochan) { set %dj2 $nick | dotopic }
else { notice $nick You do not have access to this command }
}
on *:TEXT:@offair1:%radiochan:{
if ($nick == %dj1) { set %dj1 None | dotopic }
else {halt}
}
on *:TEXT:@offair2:%radiochan:{
if ($nick == %dj2) { set %dj2 None | dotopic }
else {halt}
}
#Request
on *:TEXT:@request1*:%radiochan:{
if (%dj1 == None) { notice $nick No DJ Online! }
else { msg %dj1 Request from $nick $+ : $2- }
}
on *:TEXT:@request2*:%radiochan:{
if (%dj2 == None) { notice $nick No DJ Online! }
else { notice $nick Request Sent! | msg %dj2 Request from $nick $+ : $2- }
}
#Servers
on *:TEXT:@server1:%radiochan:{ sockopen listeners %stream1.host %stream1.port }
on *:TEXT:@server2:%radiochan:{ sockopen listeners2 %stream2.host %stream2.port }
on *:TEXT:@servers:%radiochan:{ msg $chan @server1 :: @server2 }
#Stats
on *:TEXT:@stream1:%radiochan:{ set %stream Stream1 | set %stream.host 204.14.122.200 | set %stream.port 8000 | sockopen stream %stream1.host %stream1.port }
on *:TEXT:@stream2:%radiochan:{ set %stream Stream2 | set %stream.host 66.111.225.9 | set %stream.port 8000 | sockopen stream %stream2.host %stream2.port }
on *:SOCKOPEN:stream:{
if ($sockerr > 0) {
msg %radiochan %stream = OFLINE
return
}
sockwrite -n $sockname GET /7.html HTTP/1.0
sockwrite -n $sockname User-Agent: Mozilla
sockwrite -n $sockname $crlf
}
on *:sockread:stream:{
if ($sockerr > 0) return
:nextread
sockread -f %temp
if ($sockbr == 0) return
if (%temp == $null) %temp = empty
set %temp $remove(%temp,<HTML><meta http-equiv="Pragma" content="no-cache"></head><body>,</body></html> )
if ((HTTP/1.* !iswm %temp) && (content-type* !iswm %temp) && (%temp != empty)) {
set %status $gettok(%temp,2,44)
set %listeners $gettok(%temp,1,44)
set %song $gettok(%temp,7-,44)
set %maxlist $gettok(%temp,4,44)
set %peaklisteners $gettok(%temp,3,44)
set %bitrate $gettok(%temp,6,44)
}
goto nextread
}
on *:sockclose:stream:{
if ( %status == 0 ) {
msg %radiochan %stream = OFFLINE
}
else {
msg %radiochan [[^B] $+ %stream $+ ][^B] [^B]DJ:[^B] %dj1 [^B]Listen Now:[^B] http:// $+ %stream.host $+ : $+ %stream.port $+ /listen.pls [^B]Song:[^B] %song : [^B]Listeners:[^B] %listeners of %maxlist max (Peak: %peaklisteners $+ ) [^B]Bitrate:[^B] %bitrate kbps
}
}
on *:SOCKOPEN:listeners:{
if ($sockerr > 0) {
Server1 [^B]DJ:[^B] %dj2 [^B]Listeners:[^B] OFFAIR
return
}
sockwrite -n $sockname GET /7.html HTTP/1.0
sockwrite -n $sockname User-Agent: Mozilla
sockwrite -n $sockname $crlf
}
on *:sockread:listeners:{
if ($sockerr > 0) return
:nextread
sockread -f %temp
if ($sockbr == 0) return
if (%temp == $null) %temp = empty
set %temp $remove(%temp,<HTML><meta http-equiv="Pragma" content="no-cache"></head><body>,</body></html> )
if ((HTTP/1.* !iswm %temp) && (content-type* !iswm %temp) && (%temp != empty)) {
set %status $gettok(%temp,2,44)
set %listeners $gettok(%temp,1,44)
}
goto nextread
}
on *:sockclose:listeners:{
if ( %status == 0 ) {
msg %radiochan Server1 [^B]DJ:[^B] %dj2 [^B]Listeners:[^B] OFFAIR
}
else {
msg %radiochan Server1[^B]DJ:[^B] %dj1 [^B]Listeners:[^B] %listeners }
}
on *:SOCKOPEN:listeners2{
if ($sockerr > 0) {
Server2 [^B]DJ:[^B] %dj2 [^B]Listeners:[^B] OFFAIR
return
}
sockwrite -n $sockname GET /7.html HTTP/1.0
sockwrite -n $sockname User-Agent: Mozilla
sockwrite -n $sockname $crlf
}
on *:sockread:listeners2:{
if ($sockerr > 0) return
:nextread
sockread -f %temp
if ($sockbr == 0) return
if (%temp == $null) %temp = empty
set %temp $remove(%temp,<HTML><meta http-equiv="Pragma" content="no-cache"></head><body>,</body></html> )
if ((HTTP/1.* !iswm %temp) && (content-type* !iswm %temp) && (%temp != empty)) {
set %status $gettok(%temp,2,44)
set %listeners $gettok(%temp,1,44)
}
goto nextread
}
on *:sockclose:listeners2{
if ( %status == 0 ) {
msg %radiochan Server2 [^B]DJ:[^B] %dj2 [^B]Listeners:[^B] OFFAIR
}
else {
msg %radiochan Server2 [^B]DJ:[^B] %dj2 [^B]Listeners:[^B] %listeners
}