on *:TEXT:!song:#: up
if ($sock(up)) { msg $nick Thats already running, try again | halt }
set %chan $chan
alias up {
sockopen up matt-henty.co.uk 80
set %chan $chan
}
on *:SOCKOPEN:up: {
/sockwrite -nt $sockname GET matt-henty.co.uk HTTP/1.1
/sockwrite -nt $sockname Host: /sam/playing.html
/sockwrite -nt $sockname $crlf
}
on *:SOCKREAD:up: {
if ($sockerr) {
msg %chan Error while reading sock. ( $+ $sockerr $+ )
halt
}
else {
set %read | sockread %read
if (*Currently Playing:* iswm %read) {
set %read $nohtml(%read)
set %read $remove(%read, $chr(33))
msg %chan $c1(12Current Song Playing:) $c2($gettok(%read, 1-, 58) $+ !)
unset %chan
sockclose up
}
}
}
alias nohtml { var %x,%y = $regsub($1-,/(<[^>]+>)/g,$null,%x) | return %x }
alias c1 { return $+(,$1-,) }
alias c2 { return $+(,,$1-,,) }