rendered paste body; ShoutCast
on *:TEXT:.radio:#:{
set %shouturl SHOUTCAST_SERVER_URL_HERE
set %shoutcast $chan
shoutcast $remove($replace(%shoutserv,$chr(58),$chr(32)),$chr(47),http,listen.pls)
}
alias shoutcast {
set %shoutcast2 $true
sockopen shoutcast $1 $2
}
on *:SOCKOPEN:shoutcast:{
sockwrite -tn shoutcast GET $iif(%shoutcast2,/,/7.html) HTTP/1.0
sockwrite -tn shoutcast Host: $sock(shoutcast).ip
sockwrite -tn shoutcast $iif(%shoutcast2 == $false,User-Agent: Mozilla/5.0)
sockwrite -tn shoutcast
}
on *:SOCKREAD:shoutcast:{
sockread -f %r
if (%shoutcast2) {
tokenize 58 %r
if ($1 == icy-name) {
set %shoutcast %shoutcast $2 - %shoutserv $3
}
elseif ($1 == icy-br) {
set %shoutcast2 $false
set %shoutcast3 $sock(shoutcast).ip $sock(shoutcast).port
sockclose shoutcast
sockopen shoutcast %shoutcast3
}
}
else {
sockread -f %r
tokenize 44 $remove(%r,<HTML><meta http-equiv="Pragma" content="no-cache"></head><body>,</body></html>)
if ($2-) {
msg %shoutcast - listeners: $5 - now playing: $7
}
}
}