rendered paste body########################
# tvrage LOOKUP SCRIPT #
# v1.1 #
# Fixed some regexps #
########################
bind pub - !tv dlx:tvrage
proc dlx:tvrage { nick host hand chan arg } {
if { $chan != "#5" && $chan != "#5.ops" } {
set arg [string map { " " "_" } $arg]
set gotrelease [regexp {([A-Za-z0-9.]+).S[0-9][0-9]E[0-9][0-9]} $arg gotrelease release]
if { $gotrelease } {
set arg $release
}
set url "http://www.tvrage.com/quickinfo.php?show=$arg"
set page [exec curl -s $url]
set prefix "-\002DKP\002-"
regexp {Show Name@([A-Za-z 0-9\&\':]+)} $page gotname show_name
regexp {Show URL@http://www.tvrage.com/([A-Za-z_0-9/-]+)} $page goturl show_url
regexp {Premiered@([0-9]+)} $page gotpremiere show_premiered
regexp {Latest Episode@([0-9x]+)\^([A-Za-z0-9 \`\´\"\'\&:.,]+)\^([A-Za-z0-9/]+)} $page gotlatest latest_ep latest_ep_title latest_ep_date
set gotnext [regexp {Next Episode@([0-9x]+)\^([A-Za-z0-9 \`\´\"\'\&:.,]+)\^([A-Za-z0-9/]+)} $page gotnext next_ep next_ep_title next_ep_date]
regexp {Country@([A-Za-z]+)} $page gotcountry show_country
regexp {Status@([A-Za-z/ ]+)} $page gotstatus show_status
regexp {Classification@([A-Za-z ]+)} $page gotclassification show_classification
set gotgenres [regexp {Genres@([A-Za-z |]+)} $page gotgenres show_genres]
regexp {Network@([A-Za-z 0-9]+)} $page gotnetwork show_network
regexp {Airtime@([A-Za-z, 0-9:]+)} $page gotairtime show_airtime
set show_url "http://www.tvrage.com/$show_url"
if { $gotgenres == 0 } { set show_genres "N/A" }
if { $gotnext == 0 } {
set next_ep "00x00"
set next_ep_title "-N/A-"
set next_ep_date "not available"
}
if { $gotrelease == 0 } {
putquick "PRIVMSG $chan :$prefix Show: $show_name ($show_genres)"
putquick "PRIVMSG $chan :$prefix Last Episode: $latest_ep\:$latest_ep_title ($latest_ep_date)"
putquick "PRIVMSG $chan :$prefix Next Episode: $next_ep\:$next_ep_title ($next_ep_date)"
putquick "PRIVMSG $chan :$prefix URL: $show_url"
} else {
putquick "PRIVMSG $chan :$prefix $show_name :: Genre: $show_genres :: URL: $show_url"
}
}
}