on *:TEXT:-*:#:{ var %tgr $1 tokenize 32 $mid($1-,2) if ($1 == song) { sockopen scstat %scstat.host %scstat.port | set %getsong 1 } if ($1 == listeners) { sockopen scstat %scstat.host %scstat.port | set %getlisteners 1 } if ($1 == stream) { sockopen scstat %scstat.host %scstat.port | set %getstream 1 } if ($1 == getall) { sockopen scstat %scstat.host %scstat.port | set %getall 1 } if ($1 == commands) { msg %scstat.chan %tgr } if ($1 == scstat) { set %scstat.chan $chan set %scstat.host $gettok($2,1,58) set %scstat.port $gettok($2,2,58) sockclose scstat sockopen scstat $gettok($2,1,58) $gettok($2,2,58) set %getall 1 } } on *:SOCKOPEN:scstat:{ sockwrite -n $sockname GET /7.html HTTP/1.0 sockwrite -n $sockname User-Agent: Mozilla sockwrite -n $sockname $crlf } on *:sockread:scstat:{ if ($sockerr > 0) return :nextread sockread -f %scasttemp if ($sockbr == 0) return if (%scasttemp == $null) %scasttemp = empty set %scasttemp $remove(%scasttemp,,) if ((HTTP/1.* !iswm %scasttemp) && (content-type* !iswm %scasttemp) && (%scasttemp != empty)) { set %scstat.song $gettok(%scasttemp,7-,44) set %scstat.bitrate $gettok(%scasttemp,6,44) set %scstat.listeners $gettok(%scasttemp,1,44) set %scstat.maxlist $gettok(%scasttemp,4,44) set %scstat.peak $gettok(%scasttemp,3,44) if ($gettok(%scasttemp,2,44) == 1) set %scstat.livedj connected else set %scstat.livedj not connected ; changing some of the html codes back to regular characters set %scast.song $replace(%scast.song,&,$chr(38),',$chr(39)) } goto nextread } on *:sockclose:scstat:{ if (%getsong == 1) { msg %scstat.chan 0,10[ 12SONG 0] [14 Now playing song %scstat.song 0] | unset %getsong } if (%getlisteners == 1) { msg %scstat.chan 0,10[ 12LISTENERS 0] [14 %scstat.listeners $+  out of  $+ %scstat.maxlist $+  listeners at  $+ $+(%scstat.bitrate,Kb) $+  using up $+(,$round($calc(((%scstat.bitrate *1024) * %scstat.listeners)/ 1024 / 1024),2),Mb/s) or $+(,$round($calc(((%scstat.bitrate *1024) * %scstat.listeners)/ 1024 ),2),Kb/s) or $+(,$round($calc(((%scstat.bitrate *1024) * %scstat.listeners)/ 1024 / 8),2),KB/s) 0] | unset %getlisteners } if (%getstream == 1) { msg %scstat.chan 0,10[ 12STREAM 0] [14 $iif(%scstat.livedj == connected,Up and running : $+ $chr(41) You can listen at $+(http://,%scstat.host,:,%scstat.port,/listen.pls),Stream is currently down) 0] | unset %getstream } if (%getall == 1) { msg %scstat.chan 0,10[ 12DSP 0] [14  $+ %scstat.livedj $+  and playing  $+ %scstat.song $+  0] msg %scstat.chan 0,10[ 12Listeners 0] [14  $+ %scstat.listeners $+  out of  $+ %scstat.maxlist $+  listeners at  $+ $+(%scstat.bitrate,Kb) $+  using up $+(,$round($calc(((%scstat.bitrate *1024) * %scstat.listeners)/ 1024 / 1024),2),Mb/s) or $+(,$round($calc(((%scstat.bitrate *1024) * %scstat.listeners)/ 1024 ),2),Kb/s) or $+(,$round($calc(((%scstat.bitrate *1024) * %scstat.listeners)/ 1024 / 8),2),KB/s) 0] msg %scstat.chan 0,10[ 12listen at 0] [14 You can listen at $+(http://,%scstat.host,:,%scstat.port,/listen.pls) 0] unset %getall } }