I've stripped apart an older version of dlx's TVRage script and made it lighter.
It only includes the tv, tvnext and tvlast commands.
<znf> .tv Game of Thrones
<Lamestbot> (TV) Show: Game of Thrones (Scripted | Action | Drama | Fantasy)
<Lamestbot> (TV) Premiered: 2010 • Status: Returning Series
<Lamestbot> (TV) URL: http://www.tvrage.com/Game_of_Thrones
<Lamestbot> (TV) Previous Ep: 01x10 on Jun/19/2011 • Next Ep: 02x01 on Apr/15/2012
<znf> .tvnext Game of Thrones
<Lamestbot> (TV) The next episode of Game of Thrones is Season 2, Episode 1 [02x01], it will air on Sunday at 09:00 pm Apr/15/2012. Previous episode was 01x10 on Jun/19/2011.
<znf> .tvlast Game of Thrones
<Lamestbot> (TV) The last episode of Game of Thrones was Fire and Blood [01x10], it aired on Jun/19/2011. Next episode is 02x01 scheduled on Apr/15/2012.
Code: Select all
################################################################################
# TVInfo Light #
# Based on dlx's tvrage lookup script #
################################################################################
# #
# v001 - 23/08/2011 #
# - Initial release, stripped appart dlx's tvrage script #
# #
################################################################################
bind pub - .tv tv
bind pub - .tvnext tvnext
bind pub - .tvlast tvlast
# timeout value - in miliseconds
set timeout "5000"
#set a prefix for the output, you can use %bull, %bold, %uline, %color
set prefix "(TV) "
proc showinfo { chan arg } {
global prefix
set arg "$prefix$arg"
set arg [replacevar $arg "%bold" "\002"]
set arg [replacevar $arg "%uline" "\037"]
set arg [replacevar $arg "%bull" "\u2022"]
set arg [replacevar $arg "%color" "\003"]
set arg [encoding convertto utf-8 $arg]
putquick "PRIVMSG $chan :$arg"
}
proc tv { nick host hand chan arg } {
global timeout
package require http
set arg [string map { " " "%20" } $arg]
set url "http://services.tvrage.com/tools/quickinfo.php?show=$arg"
set page [http::data [http::geturl $url -timeout $timeout]]
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
if { ![info exists show_name] } {
showinfo $chan "Error! (timeout or something similar)"
# return -1
}
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"
}
showinfo $chan "%color7Show:%color %bold$show_name%bold ($show_classification \| $show_genres)"
showinfo $chan "%color7Premiered:%color %bold$show_premiered%bold %bull %color7Status:%color %bold$show_status%bold"
showinfo $chan "%color7URL:%color %bold$show_url"
showinfo $chan "%color7Previous Ep:%color %bold$latest_ep on $latest_ep_date%bold %bull %color7Next Ep:%color %bold$next_ep on $next_ep_date"
}
proc tvnext { nick host hand chan arg } {
global timeout
package require http
set arg [string map { " " "_" } $arg]
set url "http://services.tvrage.com/tools/quickinfo.php?show=$arg"
set page [http::data [http::geturl $url -timeout $timeout]]
regexp {Show Name@([A-Za-z 0-9\&\':]+)} $page gotname show_name
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 {Airtime@([A-Za-z, 0-9:]+)} $page gotairtime show_airtime
if { ![info exists show_name] } {
showinfo $chan "Error! (timeout or something similar)"
}
if { $gotnext == 0 } {
showinfo $chan "The next episode of %bold$show_name%bold is not yet scheduled. That makes me a %color7sad panda%color :(."
} else {
showinfo $chan "The next episode of %bold$show_name%bold is %bold$next_ep_title \[$next_ep\]%bold, it will air on %bold$show_airtime $next_ep_date%bold. Previous episode was $latest_ep on $latest_ep_date."
}
}
proc tvlast { nick host hand chan arg } {
global timeout
package require http
set arg [string map { " " "_" } $arg]
set url "http://services.tvrage.com/tools/quickinfo.php?show=$arg"
set page [http::data [http::geturl $url -timeout $timeout]]
regexp {Show Name@([A-Za-z 0-9\&\':]+)} $page gotname show_name
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]
if { ![info exists show_name] } {
showinfo $chan "Error! (timeout or something similar)"
}
if {$gotnext == 0} {
showinfo $chan "The last episode of %bold$show_name%bold was %bold$latest_ep_title \[$latest_ep\]%bold, it aired on %bold$latest_ep_date%bold. Next episode is not yet scheduled :-(."
}
showinfo $chan "The last episode of %bold$show_name%bold was %bold$latest_ep_title \[$latest_ep\]%bold, it aired on %bold$latest_ep_date%bold. Next episode is %bold$next_ep%bold scheduled on %bold$next_ep_date%bold."
}
putlog "TVInfo Light v001: LOADED"