# episodeworld.com v1.0.1 check by casn_
#
# your trigger
set ew(trig) "!ew"
# path to your lynx dump file
set ew(dump) "/home/lamer/eggdrop/lynx.dump"
# chan to use
set ew(chan) "#lame_chan"
# actual episodeworld.com url to use (don't touch it!)
set ew(url) "http://www.episodeworld.com/show/"
# output line start
set ew(lay) "\002\[\002epworld\002\]\002"
#########################################################################
bind pub - $ew(trig) ew_get
proc ew_get {nick host hand chan arg} {
global ew
if {$chan != $ew(chan)} {return}
if {[string length $arg] < 1} {
puthelp "PRIVMSG $chan :usage: $ew(trig) <series name>"
}
set title "n/a"
set net "n/a"
set lang "n/a"
set theme "n/a"
set seasons "n/a"
set suburl [string map {" " "_"} $arg]
exec lynx --dump $ew(url)$suburl > $ew(dump)
set fp [open $ew(dump) r]
while {![eof $fp]} {
gets $fp line
if {[string match "*) - (Status:*" $line]} {
set title [lrange $line 0 end]
}
if {[string match "*Premiered on Network:*" $line]} {
set net [lrange $line 3 end]
}
if {[string match "*Language:*" $line]} {
set lang [lrange $line 0 end]
}
if {[string match "*Theme song:*" $line]} {
set theme [lrange $line 0 end]
}
if {[string match "*Season*" $line] && $seasons == "n/a" && ![string match "*DVD*" $line]} {
set seasons [lrange $line 0 1]
}
}
close $fp
if {$title == "n/a"} {
putquick "PRIVMSG $chan :$ew(lay) not found."
return
}
putquick "PRIVMSG $chan :$ew(lay) $title"
putquick "PRIVMSG $chan :$ew(lay) Current (last) Season: $seasons"
putquick "PRIVMSG $chan :$ew(lay) Network: $net / $lang"
if {$theme != "n/a"} {
putquick "PRIVMSG $chan :$ew(lay) [string map {"\{" "\"" "\}" "\""} $theme]"
}
}
putlog "episodeworld check by casn_ started."