on *:TEXT:*:#:{
tokenize 32 $strip($1-)
if (*!ep* iswm $1-) {
/tvrage $2
if ( %show_class != Scripted ) { halt }
<rest of code>
}
}
alias tvrage {
unset %tvrage*
unset %tv.*
unset %show*
%tvrage = $replace($1,$chr(46),% $+ 20)
%tv.rel = $replace($1,$chr(46),$chr(32))
set %tv.release $2
set %tv.section $3
sockopen tvrage http://www.tvrage.com 80
}
on *:sockopen:tvrage:{
sockwrite tvrage GET $+(http://www.tvrage.com/quickinfo.php?show=, %tvrage,$crlf) HTTP/1.1
sockwrite -n tvrage Host: $+(www.tvrage.com,$crlf,$crlf)
}
on *:sockread:tvrage:{
if ($sockerr) { return }
var %tvdata
sockread %tvdata
if (show name isin %tvdata) { set %show_name $gettok(%tvdata,2,64) }
if (show url isin %tvdata) { set %show_url $gettok(%tvdata,2,64) }
if (premiered isin %tvdata) { set %show_premiered $gettok(%tvdata,2,64) }
if (latest episode isin %tvdata) { set %show_late_ep $gettok(%tvdata,2,64) }
if (next episode isin %tvdata) { set %show_next_ep $gettok(%tvdata,2,64) }
if (country isin %tvdata) { set %show_country $gettok(%tvdata,2,64) }
if (status isin %tvdata) { set %show_status $gettok(%tvdata,2,64) }
if (classification isin %tvdata) { set %show_class $gettok(%tvdata,2,64) }
if (genres isin %tvdata) { set %show_genre $gettok(%tvdata,2,64) }
if (network isin %tvdata) { set %show_network $gettok(%tvdata,2,64) }
if (airtime isin %tvdata) { set %show_airtime $gettok(%tvdata,2,64) }
if (runtime isin %tvdata) { set %show_runtime $gettok(%tvdata,2,64) }
if (!sockbr) { return }
}
on *:sockclose:tvrage:{
msg $chan Show: %show_name • Genre: %show_genre • Premiered: %show_premiered • Latest: %show_late_ep • Next: %show_next_ep • Status: %show_status
}