rendered paste bodyalias streamstat {
window @temp2
sockopen shoutcast $1 $2
}
on *:sockopen:shoutcast:{
if ($sockerr) { disp Can't connect to: $+($hget(shout,ip),:,$hget(shout,port)) | return }
var %a = sockwrite -n shoutcast
%a GET / HTTP/1.0
%a Host: $sock(shoutcast).ip
%a User-Agent: mSSC/1.1
%a Accept: */*
%a Icy-MetaData:0
%a Connection: close
%a
}
on *:sockread:shoutcast:{
var %a
if (%x != 1) {
sockread %a
while ($sockbr) {
if (%a) {
tokenize 58 %a
if (%a == ICY 200 OK) { aline @temp2 Connected successfuly }
elseif ($1 == icy-name) { aline @temp2 name: $2- }
elseif ($1 == icy-genre) { aline @temp2 genre: $2- }
elseif ($1 == icy-url) { aline @temp2 url: $2- }
set %x 1
}
}
}
}