All pastes #251894 Raw Edit

Untitled

public text v1 · immutable
#251894 ·published 2006-11-18 19:56 UTC
rendered paste body
on *:TEXT:!song:#: {
if ($sock(up)) { .notice $nick This script is already in use. Try again in a couple of seconds. }
else {
set %chan $chan
sockopen up matt-henty.co.uk 80
}
}

on *:SOCKOPEN:up: { 
  /sockwrite -nt $sockname GET /sam/playing.html HTTP/1.1
  /sockwrite -nt $sockname Host: matt-henty.co.uk
  /sockwrite -nt $sockname $crlf 
} 
on *:SOCKREAD:up: { 
  if ($sockerr) { 
    msg %chan Error while reading sock. ( $+ $sockerr $+ ) 
    halt 
  } 
  else { 
    set %read | sockread %read
    if (<td><font size="2" color="#003366"><small>*</small></font></td> iswm %read) {
      set %read $nohtml(%read)
      msg %chan 12Current Song Playing: %read
      unset %chan 
      sockclose up 
    }
  } 
}
alias nohtml { var %x,%y = $regsub($1-,/(<[^>]+>)/g,$null,%x) | return %x }