All pastes #48994 Raw Edit

Something

public text v1 · immutable
#48994 ·published 2006-04-11 08:52 UTC
rendered paste body
alias tv {
  set %string $1-
  set %show.all $replace($strip($2-),.,$chr(32),-,$chr(32))
  set %tvrage.temp $replace($2-,$chr(32),+)
  set %show.find $1
  unset %tvreturn
  sockopen tvrage http://www.tvrage.com 80
  pause ms 50
  echo -a %tvreturn 
}
alias tv_return {
  set %show.all $replace($strip($2-),.,$chr(32),-,$chr(32))
  set %tvrage.temp $replace($2-,$chr(32),+)
  set %show.find $1
  unset %tvreturn
  sockopen tvrage http://www.tvrage.com 80
  pause ms 30
  return %tvreturn
}
on *:sockopen:tvrage:{
  sockwrite -n $sockname GET http://www.tvrage.com/quickinfo.php?show= $+ %tvrage.temp
}
on *:sockread:tvrage:{
  if ($sockerr) {
    echo -a Error opening tvrage socket.
    halt
  }
  else {
    var %temptext
    sockread %temptext
    ;    if (Show Name isin %temptext && %show.all !iswm %temptext) {
    ;      set %tvreturn halt
    ;      sockclose tvrage
    ;    }
    if (%show.find == type && Classification* iswm $strip(%temptext)) {
      set %tvreturn $gettok(%temptext,2-,64)
    }
    elseif (%show.find == country && Country* iswm $strip(%temptext)) {
      set %tvreturn $gettok(%temptext,2-,64)
    }
    elseif (%show.find == year && Premiered* iswm $strip(%temptext)) {
      set %tvreturn $gettok(%temptext,2-,64)
    }
    elseif (%show.find == all) {
      if (Show Name* iswm $strip(%temptext)) {
        echo -a $gettok(%temptext,2-,64)
      }
      if (Premiered* iswm $strip(%temptext)) {
        set %tvtemp $gettok(%temptext,2-,64) $+ * 
      }
      else if (Country* iswm $strip(%temptext)) {
        set %tvtemp %tvtemp $+ $gettok(%temptext,2-,64) $+ *
      }
      else if (Classification* iswm $strip(%temptext)) {
        set %tvreturn %tvtemp $+ $gettok(%temptext,2-,64)
      }
    }
    elseif (%show.find !iswm all|year|type|country) {
      set %tvreturn Not the right info!!!
    }
  }
}
alias nohtml {
  var %parsed, %regex = $regsub($1-,m~([^<]*>|<[^>]+>|<[^>]*)|(&nbsp;)~g,$chr(32),%parsed)
  return %parsed
}
alias pause {
  var %e = !echo $color(info) -a * /pause:
  if (!$regex(pause,$1-,/^m?s \d+$/Si)) {
    %e incorrect/insufficient parameters. Syntax: /pause <s|ms> <N>
  }
  elseif ($1 == ms) && ($istok(95 98 ME,$os,32)) {
    %e cannot use milliseconds parameter on OS'es beneath Win2k
  }
  elseif ($2 !isnum 1-) {
    %e must specify a number within range 1-
  }
  else {
    var %wsh = wsh $+ $ticks, %cmd
    if ($1 == s) %cmd = ping.exe -n $int($calc($2 + 1)) 127.0.0.1
    else %cmd = pathping.exe -n -w 1 -q 1 -h 1 -p $iif($2 > 40,$calc($2 - 40),$2) 127.0.0.1
    .comopen %wsh wscript.shell
    .comclose %wsh $com(%wsh,run,1,bstr*,% $+ comspec% /c %cmd >nul,uint,0,bool,true)
  }
}