| View previous topic :: View next topic |
| Author |
Message |
doggo Halfop
Joined: 05 Jan 2010 Posts: 97
|
Posted: Wed Apr 04, 2012 1:35 pm Post subject: imdbapi.com v1 |
|
|
Hi all, im still fairly noob at tcl.. but ive been working on this script that makes use the api @ http://imdbapi.com
I have been testing it for about a week now making sure it all works ok and wanted to share it with you guys
what it looks like http://i.imgur.com/zuMww.png
All you should need do is load the script and edit these 3 variables and ue the help trigger..
| Code: |
??imdb
[06:44pm] <doggo> ??imdb
[06:44pm] <spunky> [IMDB Search Help]
[06:44pm] <spunky> [Search IMDB Id] -tt tt0234215 | or | -tt tt0234215 switch
[06:44pm] <spunky> [Search Titles] -imdb the matrix reloaded | or | -imdb the matrix reloaded --switch
[06:44pm] <spunky> [Search Switches] title year rated released genre director writer cast plot poster runtime rating votes link | no switch = spam :D
|
and have yr bot explain it
| Code: |
#trigger to search by ttid
variable info_tttrig "-tt"
#title search trigger
variable info_strig "-imdb"
#channel to work in
variable imdb_channel "#omgwtfnzbs"
|
Here it is
| Code: | # 04/04/2012
# by doggo #omgwtfnzbs @ EFNET
# drop in and try this script ;) all feedback is welcome
namespace eval imdb {
namespace eval api {
#time limit between cmds
variable flood_set "10"
#trigger to search by ttid
variable info_tttrig "-tt"
#title search trigger
variable info_strig "-imdb"
#channel to work in
variable imdb_channel "#omgwtfnzbs"
variable ttsearch_url "http://www.imdbapi.com/?i"
variable titlesearch_url "http://www.imdbapi.com/?t"
variable pub "PRIVMSG $imdb::api::imdb_channel"
variable info_htrig "??imdb"
}
bind pub -|- $imdb::api::info_tttrig imdb::imdb_evaluate::evaluate_imdb
bind pub -|- $imdb::api::info_strig imdb::imdb_evaluate_search::search_evaluate_imdb
bind pub -|- $imdb::api::info_htrig imdb::imdb_helper::helper_imdb
# get info from ttid proc
namespace eval imdb_evaluate {
proc evaluate_imdb {nick hand host chan titleid} {
#flood protection, borrowed from http://forum.egghelp.org/viewtopic.php?t=17078 :D
variable imdb_flood
if {[info exists imdb_flood(lasttime,$chan)] && [expr $imdb_flood(lasttime,$chan) + $imdb::api::flood_set] > [clock seconds]} {
puthelp "$imdb::api::pub :You can use only 1 command in $imdb::api::flood_set seconds. Wait [expr $imdb::api::flood_set - [expr [clock seconds] - $imdb_flood(lasttime,$chan)]] seconds and try again.";return
}
set titleid [stripcodes bcruag $titleid]
set ttid [lindex [split $titleid] 0]
set action ""
set action [lindex [split $titleid] 1]
if {$ttid==""} {putquick "$imdb::api::pub :Usage: $imdb::api::info_ttrig tt1899353";return}
if {![regexp {^tt([0-9]+)$} $ttid match imdbid] } {putquick "$imdb::api::pub :Error: not a valid ttid";return}
catch {set http [::http::geturl $imdb::api::ttsearch_url=tt$imdbid -timeout 15000]} error
set information [::http::data $http]
::http::cleanup $http
regexp -nocase {response\"\:\"(.*?)\"} $information match response
if {![info exists response]} {putquick "$imdb::api::pub :$imdb::api::ttsearch_url=tt$imdbid timed out.. try again in a bit ";return}
if {![string match "True" $response]} {putquick "$imdb::api::pub :Error: Unknown IMDb ID";return}
::imdb::imdb_trigger::trigger_imdb $information $action
set imdb_flood(lasttime,$chan) [clock seconds]
}
}
# get info from title search proc
namespace eval imdb_evaluate_search {
proc search_evaluate_imdb {nick hand host chan search_text} {
#flood protection, borrowed from http://forum.egghelp.org/viewtopic.php?t=17078 :D
variable imdb_flood
if {[info exists imdb_flood(lasttime,$chan)] && [expr $imdb_flood(lasttime,$chan) + $imdb::api::flood_set] > [clock seconds]} {
puthelp "$imdb::api::pub :You can use only 1 command in $imdb::api::flood_set seconds. Wait [expr $imdb::api::flood_set - [expr [clock seconds] - $imdb_flood(lasttime,$chan)]] seconds and try again.";return
}
set search_term [stripcodes bcruag $search_text]
set do_search [lrange [split $search_term] 0 end]
set imdbswitch ""
if {$do_search==""} {putquick "$imdb::api::pub :Usage: $imdb::api::info_strig Mission Impossible";return}
if {[regexp -nocase {^([a-z0-9\s]+)\s\-\-([a-z]+)$} $do_search match imdbsearch imdbswitch]} {
catch {set http [::http::geturl $imdb::api::titlesearch_url=[string map { " " "+" } $imdbsearch] -timeout 15000]} error
set information [::http::data $http]
::http::cleanup $http
regexp -nocase {response\"\:\"(.*?)\"} $information match response
if {![info exists response]} {putquick "$imdb::api::pub :Error: $imdb::api::titlesearch_url=[string map { " " "+" } $imdbsearch] timed out.. try again in a bit ";return}
if {![string match "True" $response]} {putquick "$imdb::api::pub :Error: 0 Results for $imdbsearch";return}
::imdb::imdb_trigger::trigger_imdb $information $imdbswitch
} elseif {[regexp {^([a-z0-9\s]+)$} $do_search match imdbsearch]} {
catch {set http [::http::geturl $imdb::api::titlesearch_url=[string map { " " "+" } $imdbsearch] -timeout 15000]} error
set information [::http::data $http]
::http::cleanup $http
regexp -nocase {response\"\:\"(.*?)\"} $information match response
if {![info exists response]} {putquick "$imdb::api::pub :Error: $imdb::api::titlesearch_url=[string map { " " "+" } $imdbsearch] timed out.. try again in a bit ";return}
if {![string match "True" $response]} {putquick "$imdb::api::pub :Error: 0 Results for $imdbsearch";return}
::imdb::imdb_trigger::trigger_imdb $information $imdbswitch
} else {
putquick "$imdb::api::pub :Error: bad input";return
}
set imdb_flood(lasttime,$chan) [clock seconds]
}
}
# parse the returned jason proc
namespace eval imdb_trigger {
proc trigger_imdb {api_response type} {
set information [lindex $api_response 0]
set action [lindex $type 0]
regexp -nocase {title\"\:\"(.*?)\"} $information match title
regexp -nocase {year\"\:\"(.*?)\"} $information match year
regexp -nocase {rated\"\:\"(.*?)\"} $information match rated
regexp -nocase {released\"\:\"(.*?)\"} $information match released
regexp -nocase {genre\"\:\"(.*?)\"} $information match genre
regexp -nocase {director\"\:\"(.*?)\"} $information match director
regexp -nocase {writer\"\:\"(.*?)\"} $information match writer
regexp -nocase {actors\"\:\"(.*?)\"} $information match actors
regexp -nocase {plot\"\:\"(.*?)\"} $information match plot
regexp -nocase {poster\"\:\"(.*?)\"} $information match poster
regexp -nocase {runtime\"\:\"(.*?)\"} $information match runtime
regexp -nocase {rating\"\:\"(.*?)\"} $information match rating
regexp -nocase {votes\"\:\"(.*?)\"} $information match votes
regexp -nocase {ID\"\:\"(.*?)\"} $information match id
switch -exact -- [string tolower $action] {
"title" {
putquick "$imdb::api::pub :\00308\[IMDB Title\]\017 $title"
}
"year" {
putquick "$imdb::api::pub :\00308\[IMDB Year\]\017 $year"
}
"rated" {
putquick "$imdb::api::pub :\00308\[IMDB Rated\]\017 $rated"
}
"released" {
putquick "$imdb::api::pub :\00308\[IMDB Released\]\017 $released"
}
"genre" {
putquick "$imdb::api::pub :\00308\[IMDB Genre\]\017 $genre"
}
"director" {
putquick "$imdb::api::pub :\00308\[IMDB Directed By\]\017 $director"
}
"writer" {
putquick "$imdb::api::pub :\00308\[IMDB Written By\]\017 $writer"
}
"cast" {
putquick "$imdb::api::pub :\00308\[IMDB Cast\]\017 $actors"
}
"plot" {
putquick "$imdb::api::pub :\00308\[IMDB Plot\]\017 $plot"
}
"poster" {
putquick "$imdb::api::pub :\00308\[IMDB Poster\]\017 $poster"
}
"runtime" {
putquick "$imdb::api::pub :\00308\[IMDB Runtime\]\017 $runtime"
}
"rating" {
putquick "$imdb::api::pub :\00308\[IMDB Rating\]\017 $rating"
}
"votes" {
putquick "$imdb::api::pub :\00308\[IMDB Votes\]\017 $votes"
}
"link" {
putquick "$imdb::api::pub :\00308\[Link\]\017 http://www.imdb.com/title/$id/"
}
default {
putquick "$imdb::api::pub :\00308\[Title\]\017 $title \00308\[Year\]\017 $year \00308\[Genre\]\017 $genre"
putquick "$imdb::api::pub :\00308\[Directed By\]\017 $director \00308\[Writen By\]\017 $writer"
putquick "$imdb::api::pub :\00308\[Released\]\017 $released \00308\[Rated\]\017 $rated"
putquick "$imdb::api::pub :\00308\[Cast\]\017 $actors"
putquick "$imdb::api::pub :\00308\[Plot\]\017 $plot"
putquick "$imdb::api::pub :\00308\[Poster\]\017 $poster"
putquick "$imdb::api::pub :\00308\[Runtime\]\017 $runtime \00308\[Rating\]\017 $rating \00308\[Votes\]\017 $votes"
putquick "$imdb::api::pub :\00308\[Link\]\017 http://www.imdb.com/title/$id/"
}
}
}
}
# usage helper proc
namespace eval imdb_helper {
proc helper_imdb {nick hand host chan text} {
putquick "$imdb::api::pub :\00308\[IMDB Search Help\]\017"
putquick "$imdb::api::pub :\00308\[Search IMDB Id\]\017 $imdb::api::info_tttrig tt0234215 | or | $imdb::api::info_tttrig tt0234215 switch"
putquick "$imdb::api::pub :\00308\[Search Titles\]\017 $imdb::api::info_strig the matrix reloaded | or | $imdb::api::info_strig the matrix reloaded --switch"
putquick "$imdb::api::pub :\00308\[Search Switches\]\017 title year rated released genre director writer cast plot poster runtime rating votes link | no switch = spam :D"
}
}
#//end all
} |
Feedback welcomed like i said im still a bit of a noob @ tcl scripting _________________ NON geeky!! http://gotcode4u.com/
Last edited by doggo on Sat Jun 02, 2012 9:57 am; edited 2 times in total |
|
| Back to top |
|
 |
nabbelol Voice
Joined: 12 Jan 2012 Posts: 4
|
Posted: Wed Apr 25, 2012 2:31 pm Post subject: |
|
|
Very nice script! works very well, easy to read and modify.
I would recommend you to make the color into a variable so its easier to change it :)
Also I changed the id to URL, since I see no use in just the ID, better with a click-able URL :)
I personally like more information on one line, so I changed the script to my liking. |
|
| Back to top |
|
 |
goalie204 Halfop
Joined: 28 Apr 2011 Posts: 44
|
Posted: Wed May 30, 2012 7:43 am Post subject: |
|
|
post plz, need a working imdb script
tried as posted and
-imdb the matrix
.[secksy(dcc)] [11:46] Tcl error [imdb::imdb_evaluate_search::search_evaluate_imdb]: can't read "http": no such variable
http.tcl is loaded first |
|
| Back to top |
|
 |
doggo Halfop
Joined: 05 Jan 2010 Posts: 97
|
|
| Back to top |
|
 |
goalie204 Halfop
Joined: 28 Apr 2011 Posts: 44
|
Posted: Thu May 31, 2012 12:36 pm Post subject: |
|
|
thanks putting that egghttp tcl worked and now it works
how can i change the imdb id to the url of the movie info, and how can i consolodate it a bit so its less spammy
thanks |
|
| Back to top |
|
 |
doggo Halfop
Joined: 05 Jan 2010 Posts: 97
|
Posted: Thu May 31, 2012 5:51 pm Post subject: |
|
|
take a look at this part of the code
| Code: |
default {
putquick "$imdb::api::pub :\00308\[Title\]\017 $title \00308\[Year\]\017 $year \00308\[Genre\]\017 $genre"
putquick "$imdb::api::pub :\00308\[Directed By\]\017 $director \00308\[Writen By\]\017 $writer"
putquick "$imdb::api::pub :\00308\[Rated\]\017 $rated"
putquick "$imdb::api::pub :\00308\[Released\]\017 $released"
putquick "$imdb::api::pub :\00308\[Cast\]\017 $actors"
putquick "$imdb::api::pub :\00308\[Plot\]\017 $plot"
putquick "$imdb::api::pub :\00308\[Poster\]\017 $poster"
putquick "$imdb::api::pub :\00308\[Runtime\]\017 $runtime"
putquick "$imdb::api::pub :\00308\[Rating\]\017 $rating"
putquick "$imdb::api::pub :\00308\[Votes\]\017 $votes"
putquick "$imdb::api::pub :\00308\[IMDB Id\]\017 $id"
}
|
and change it to this, ive tried to make it a bit less spammy
| Code: |
default {
putquick "$imdb::api::pub :\00308\[Title\]\017 $title \00308\[Year\]\017 $year \00308\[Genre\]\017 $genre"
putquick "$imdb::api::pub :\00308\[Directed By\]\017 $director \00308\[Writen By\]\017 $writer"
putquick "$imdb::api::pub :\00308\[Released\]\017 $released \00308\[Rated\]\017 $rated"
putquick "$imdb::api::pub :\00308\[Cast\]\017 $actors"
putquick "$imdb::api::pub :\00308\[Plot\]\017 $plot"
putquick "$imdb::api::pub :\00308\[Poster\]\017 $poster"
putquick "$imdb::api::pub :\00308\[Runtime\]\017 $runtime \00308\[Rating\]\017 $rating \00308\[Votes\]\017 $votes"
putquick "$imdb::api::pub :\00308\[Link\]\017 http://www.imdb.com/title/$id/"
}
|
also replaced [IMDB Id] with the weblink to imdbs info page
edited first post to reflect the changes _________________ NON geeky!! http://gotcode4u.com/ |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Fri Jun 01, 2012 12:06 am Post subject: |
|
|
Why don't you use puthelp instead of putquick? Doesn't the bot flood itself off?  _________________ Once the game is over, the king and the pawn go back in the same box. |
|
| Back to top |
|
 |
doggo Halfop
Joined: 05 Jan 2010 Posts: 97
|
Posted: Sat Jun 02, 2012 8:41 am Post subject: |
|
|
i used puthelp in testing, and the default output was slow to be announced in channel.. i know putquick is used more for sending messages to the sever rather than a channel or user but it did what i wanted without the bot flooding its self off..
made me think though.. (*dangerous*) there is no flood protection added in the script so potentially users could flood the bot off by searching to fast, ill look into adding some.. ive not had any problems using this script with putquick in place of puthelp though
*Edit*
Added some flood protection, made changes to first post  _________________ NON geeky!! http://gotcode4u.com/ |
|
| Back to top |
|
 |
x0x Op
Joined: 10 Feb 2009 Posts: 140
|
Posted: Fri Feb 08, 2013 4:51 pm Post subject: |
|
|
http://www.imdbapi.com changed to http://www.omdbapi.com so you need to update that to get the script to work.
Found something strange tho. When using capital letters: Error: bad input
!imdb The Matrix
Error: bad input
!imb the matrix
Works |
|
| Back to top |
|
 |
liljim Voice
Joined: 11 Dec 2007 Posts: 12
|
Posted: Mon Feb 11, 2013 12:06 am Post subject: |
|
|
| Could someone modify this so it can be used in multiple channels? Perhaps by setting +imdb or +omdb? That would be really great. |
|
| Back to top |
|
 |
x0x Op
Joined: 10 Feb 2009 Posts: 140
|
Posted: Mon Feb 11, 2013 10:20 am Post subject: |
|
|
| Besides this missing functionality, does the script work for you? Because when I use capital letters, an error occurs. |
|
| Back to top |
|
 |
liljim Voice
Joined: 11 Dec 2007 Posts: 12
|
Posted: Mon Feb 11, 2013 12:07 pm Post subject: |
|
|
| x0x wrote: | | Besides this missing functionality, does the script work for you? Because when I use capital letters, an error occurs. |
I don't know if there's a more elegant way, but changing
| Code: | | } elseif {[regexp {^([a-z0-9\s]+)$} $do_search match imdbsearch]} { |
to
| Code: | | } elseif {[regexp {^([a-z0-9A-Z\s]+)$} $do_search match imdbsearch]} { |
works for me. |
|
| Back to top |
|
 |
x0x Op
Joined: 10 Feb 2009 Posts: 140
|
Posted: Mon Feb 11, 2013 12:18 pm Post subject: |
|
|
Indeed! NICE! Thank you  |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Mon Feb 11, 2013 3:57 pm Post subject: |
|
|
As for the "more elegant" version:
| Code: | | } elseif {[regexp -nocase -- {^([[:alnum:]]+)$} $do_search match imdbsearch]} { |
(-nocase for no case comparison, and bracket expression using character classes). liljim's suggestion is just as good though. _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 792 Location: Tennessee, USA
|
Posted: Mon Feb 11, 2013 9:00 pm Post subject: Fixed I hope |
|
|
liljim wrote:
| Quote: | | Could someone modify this so it can be used in multiple channels? Perhaps by setting +imdb or +omdb? That would be really great. |
Try this untested patch to the script.
# to add channels, do: .chanset #somechan +imdbapi
EDIT: This should be working now.
| Code: |
# 04/04/2012
# by doggo #omgwtfnzbs @ EFNET
# drop in and try this script ;) all feedback is welcome
# to add channels, do: .chanset #somechan +imdbapi
setudef flag imdbapi
namespace eval imdb {
namespace eval api {
#time limit between cmds
variable flood_set "10"
#trigger to search by ttid
variable info_tttrig "-tt"
#title search trigger
variable info_strig "-imdb"
variable ttsearch_url "http://www.omdbapi.com/?i"
variable titlesearch_url "http://www.omdbapi.com/?t"
variable info_htrig "??imdb"
}
bind pub -|- $imdb::api::info_tttrig imdb::imdb_evaluate::evaluate_imdb
bind pub -|- $imdb::api::info_strig imdb::imdb_evaluate_search::search_evaluate_imdb
bind pub -|- $imdb::api::info_htrig imdb::imdb_helper::helper_imdb
# get info from ttid proc
namespace eval imdb_evaluate {
proc evaluate_imdb {nick hand host chan titleid} {
if {![channel get $chan "imdbapi"]} { return 0 }
set imdb_pub "PRIVMSG $chan"
#flood protection, borrowed from http://forum.egghelp.org/viewtopic.php?t=17078 :D
variable imdb_flood
if {[info exists imdb_flood(lasttime,$chan)] && [expr $imdb_flood(lasttime,$chan) + $imdb::api::flood_set] > [clock seconds]} {
puthelp "$imdb_pub :You can use only 1 command in $imdb::api::flood_set seconds. Wait [expr $imdb::api::flood_set - [expr [clock seconds] - $imdb_flood(lasttime,$chan)]] seconds and try again.";return
}
set titleid [stripcodes bcruag $titleid]
set ttid [lindex [split $titleid] 0]
set action ""
set action [lindex [split $titleid] 1]
if {$ttid==""} {putquick "$imdb_pub :Usage: $imdb::api::info_tttrig tt1899353";return}
if {![regexp {^tt([0-9]+)$} $ttid match imdbid] } {putquick "$imdb_pub :Error: not a valid ttid";return}
catch {set http [::http::geturl $imdb::api::ttsearch_url=tt$imdbid -timeout 15000]} error
set information [::http::data $http]
::http::cleanup $http
regexp -nocase {response\"\:\"(.*?)\"} $information match response
if {![info exists response]} {putquick "$imdb_pub :$imdb::api::ttsearch_url=tt$imdbid timed out.. try again in a bit ";return}
if {![string match "True" $response]} {putquick "$imdb_pub :Error: Unknown IMDb ID";return}
::imdb::imdb_trigger::trigger_imdb $information $action $chan
set imdb_flood(lasttime,$chan) [clock seconds]
}
}
# get info from title search proc
namespace eval imdb_evaluate_search {
proc search_evaluate_imdb {nick hand host chan search_text} {
if {![channel get $chan "imdbapi"]} { return 0 }
set imdb_pub "PRIVMSG $chan"
#flood protection, borrowed from http://forum.egghelp.org/viewtopic.php?t=17078 :D
variable imdb_flood
if {[info exists imdb_flood(lasttime,$chan)] && [expr $imdb_flood(lasttime,$chan) + $imdb::api::flood_set] > [clock seconds]} {
puthelp "$imdb_pub :You can use only 1 command in $imdb::api::flood_set seconds. Wait [expr $imdb::api::flood_set - [expr [clock seconds] - $imdb_flood(lasttime,$chan)]] seconds and try again.";return
}
set search_term [stripcodes bcruag $search_text]
set do_search [lrange [split $search_term] 0 end]
set imdbswitch ""
if {$do_search==""} {putquick "$imdb_pub :Usage: $imdb::api::info_strig Mission Impossible";return}
if {[regexp -nocase {^([a-z0-9\s]+)\s\-\-([a-z]+)$} $do_search match imdbsearch imdbswitch]} {
catch {set http [::http::geturl $imdb::api::titlesearch_url=[string map { " " "+" } $imdbsearch] -timeout 15000]} error
set information [::http::data $http]
::http::cleanup $http
regexp -nocase {response\"\:\"(.*?)\"} $information match response
if {![info exists response]} {putquick "$imdb_pub :Error: $imdb::api::titlesearch_url=[string map { " " "+" } $imdbsearch] timed out.. try again in a bit ";return}
if {![string match "True" $response]} {putquick "$imdb_pub :Error: 0 Results for $imdbsearch";return}
::imdb::imdb_trigger::trigger_imdb $information $imdbswitch $chan
} elseif {[regexp {^([a-z0-9A-Z\s]+)$} $do_search match imdbsearch]} {
catch {set http [::http::geturl $imdb::api::titlesearch_url=[string map { " " "+" } $imdbsearch] -timeout 15000]} error
set information [::http::data $http]
::http::cleanup $http
regexp -nocase {response\"\:\"(.*?)\"} $information match response
if {![info exists response]} {putquick "$imdb_pub :Error: $imdb::api::titlesearch_url=[string map { " " "+" } $imdbsearch] timed out.. try again in a bit ";return}
if {![string match "True" $response]} {putquick "$imdb_pub :Error: 0 Results for $imdbsearch";return}
::imdb::imdb_trigger::trigger_imdb $information $imdbswitch $chan
} else { putquick "$imdb_pub :Error: bad input";return }
set imdb_flood(lasttime,$chan) [clock seconds]
}
}
# parse the returned jason proc
namespace eval imdb_trigger {
proc trigger_imdb {api_response type chan} {
set information [lindex $api_response 0]
set action [lindex $type 0]
regexp -nocase {title\"\:\"(.*?)\"} $information match title
regexp -nocase {year\"\:\"(.*?)\"} $information match year
regexp -nocase {rated\"\:\"(.*?)\"} $information match rated
regexp -nocase {released\"\:\"(.*?)\"} $information match released
regexp -nocase {genre\"\:\"(.*?)\"} $information match genre
regexp -nocase {director\"\:\"(.*?)\"} $information match director
regexp -nocase {writer\"\:\"(.*?)\"} $information match writer
regexp -nocase {actors\"\:\"(.*?)\"} $information match actors
regexp -nocase {plot\"\:\"(.*?)\"} $information match plot
regexp -nocase {poster\"\:\"(.*?)\"} $information match poster
regexp -nocase {runtime\"\:\"(.*?)\"} $information match runtime
regexp -nocase {rating\"\:\"(.*?)\"} $information match rating
regexp -nocase {votes\"\:\"(.*?)\"} $information match votes
regexp -nocase {ID\"\:\"(.*?)\"} $information match id
set imdb_pub "PRIVMSG $chan"
switch -exact -- [string tolower $action] {
"title" { putquick "$imdb_pub :\00308\[IMDB Title\]\017 $title" }
"year" { putquick "$imdb_pub :\00308\[IMDB Year\]\017 $year" }
"rated" { putquick "$imdb_pub :\00308\[IMDB Rated\]\017 $rated" }
"released" { putquick "$imdb_pub :\00308\[IMDB Released\]\017 $released" }
"genre" { putquick "$imdb_pub :\00308\[IMDB Genre\]\017 $genre" }
"director" { putquick "$imdb_pub :\00308\[IMDB Directed By\]\017 $director" }
"writer" { putquick "$imdb_pub :\00308\[IMDB Written By\]\017 $writer" }
"cast" { putquick "$imdb_pub :\00308\[IMDB Cast\]\017 $actors" }
"plot" { putquick "$imdb_pub :\00308\[IMDB Plot\]\017 $plot" }
"poster" { putquick "$imdb_pub :\00308\[IMDB Poster\]\017 $poster" }
"runtime" { putquick "$imdb_pub :\00308\[IMDB Runtime\]\017 $runtime" }
"rating" { putquick "$imdb_pub :\00308\[IMDB Rating\]\017 $rating" }
"votes" { putquick "$imdb_pub :\00308\[IMDB Votes\]\017 $votes" }
"link" { putquick "$imdb_pub :\00308\[Link\]\017 http://www.imdb.com/title/$id/" }
default {
putquick "$imdb_pub :\00308\[Title\]\017 $title \00308\[Year\]\017 $year \00308\[Genre\]\017 $genre"
putquick "$imdb_pub :\00308\[Directed By\]\017 $director \00308\[Writen By\]\017 $writer"
putquick "$imdb_pub :\00308\[Released\]\017 $released \00308\[Rated\]\017 $rated"
putquick "$imdb_pub :\00308\[Cast\]\017 $actors"
putquick "$imdb_pub :\00308\[Plot\]\017 $plot"
putquick "$imdb_pub :\00308\[Poster\]\017 $poster"
putquick "$imdb_pub :\00308\[Runtime\]\017 $runtime \00308\[Rating\]\017 $rating \00308\[Votes\]\017 $votes"
putquick "$imdb_pub :\00308\[Link\]\017 http://www.imdb.com/title/$id/"
}
}
}
}
# usage helper proc
namespace eval imdb_helper {
proc helper_imdb {nick hand host chan text} {
if {![channel get $chan "imdbapi"]} { return 0 }
set imdb_pub "PRIVMSG $chan"
putquick "$imdb_pub :\00308\[IMDB Search Help\]\017"
putquick "$imdb_pub :\00308\[Search IMDB Id\]\017 $imdb::api::info_tttrig tt0234215 | or | $imdb::api::info_tttrig tt0234215 switch"
putquick "$imdb_pub :\00308\[Search Titles\]\017 $imdb::api::info_strig the matrix reloaded | or | $imdb::api::info_strig the matrix reloaded --switch"
putquick "$imdb_pub :\00308\[Search Switches\]\017 title year rated released genre director writer cast plot poster runtime rating votes link | no switch = spam :D"
}
}
#//end all
}
|
_________________ SpiKe^^
Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
Last edited by SpiKe^^ on Tue Feb 12, 2013 12:38 pm; edited 3 times in total |
|
| Back to top |
|
 |
|