View previous topic :: View next topic |
Author |
Message |
spuniun Voice
Joined: 12 Oct 2005 Posts: 10
|
Posted: Wed Oct 12, 2005 1:21 pm Post subject: |
|
|
eggdrop v1.6.17 on FreeBSD the imdb 2.3.4 script works very well except the htmlcodes do not map Code: | <spuniun> !imdb 'tie me up tie me down'
<eggdrop> ¡Átame! (1990) ( http://www.imdb.com/title/tt0101026/ )
<eggdrop> Genre: Drama / Crime / Romance
<eggdrop> 6.9/10 (2,743 votes) N/A | Any ideas? |
|
Back to top |
|
 |
Alchera Revered One

Joined: 11 Aug 2003 Posts: 3344 Location: Ballarat Victoria, Australia
|
Posted: Wed Oct 12, 2005 8:05 pm Post subject: |
|
|
Seems to be random (?).
Code: | Alchera !imdb 'Star Trek V'
-Ballarat- Star Trek VI: The Undiscovered Country (1991) - http://www.imdb.com/title/tt0102975/
-Ballarat- Genre: Action / Sci-Fi / Mystery
-Ballarat- Tagline: The battle for peace has begun
-Ballarat- Rating: 6.9/10 (11,186 votes) top 250:N/A
-Ballarat- Runtime: 113 mins.
-Ballarat- Country: USA
-Ballarat- Language: English / Klingon
-Ballarat- Budget: $30,000,000 (estimated) |
_________________ Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM |
|
Back to top |
|
 |
spuniun Voice
Joined: 12 Oct 2005 Posts: 10
|
Posted: Wed Oct 12, 2005 10:09 pm Post subject: |
|
|
Alchera wrote: | Seems to be random (?). | Was that directed at me? If so, no it's not random. Any title with HTML control chars in it does not get mapped to the correct ASCII equiv. |
|
Back to top |
|
 |
demond Revered One

Joined: 12 Jun 2004 Posts: 3073 Location: San Francisco, CA
|
Posted: Wed Oct 12, 2005 10:33 pm Post subject: |
|
|
mapping HTML escapes is pretty easy and incith, if he wishes, could implement that right away, borrowing it from my rssnews.tcl _________________ connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use [code] tag when posting logs, code |
|
Back to top |
|
 |
spuniun Voice
Joined: 12 Oct 2005 Posts: 10
|
Posted: Wed Oct 12, 2005 10:43 pm Post subject: |
|
|
the script already maps html escapes but apparently not on FreeBSD. |
|
Back to top |
|
 |
demond Revered One

Joined: 12 Jun 2004 Posts: 3073 Location: San Francisco, CA
|
Posted: Wed Oct 12, 2005 10:54 pm Post subject: |
|
|
operating system has nothing to do with that _________________ connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use [code] tag when posting logs, code |
|
Back to top |
|
 |
CosmicD Op
Joined: 11 Dec 2004 Posts: 102
|
Posted: Thu Oct 13, 2005 2:57 am Post subject: |
|
|
well.. i did !imdb red eye and I had that exact same tcl error, and always again  |
|
Back to top |
|
 |
spuniun Voice
Joined: 12 Oct 2005 Posts: 10
|
Posted: Thu Oct 13, 2005 10:51 am Post subject: |
|
|
demond wrote: | operating system has nothing to do with that | Well the HTML mapping in imdb.tcl works on my linux eggies but not on my FreeBSD ones.
I will try and crib your mapping code from rssnews. |
|
Back to top |
|
 |
english Voice
Joined: 14 Dec 2005 Posts: 2
|
Posted: Wed Dec 14, 2005 7:59 am Post subject: |
|
|
Hi all, my first post here. I found this script by using google, this is the first match for imdb eggdrop !
However I have noticed a problem with the script. It does not work for results where IMDB takes you directly to the page.... For example.
Try searching for Solyaris on imdb.com. It will take you straight to the russian version of the film, not to the search results. This then does not work in the script. However searching for solaris works fine as it takes you to the search results first.
Most films work because it takes you to the search results first, however for films where it takes you straight to the result its not working.....
From the script
Code: | #if redirect necessary, find first link and redirect
if { [regexp {<title>IMDb name and title search</title>} $html] == 1 } {
if {$IMDB_DEBUG == 1} { puthelp "NOTICE $nick :IMDB_DEBUG redirect 1" }
|
This part checks whether we have been redirected, however it never returns a true result. |
|
Back to top |
|
 |
english Voice
Joined: 14 Dec 2005 Posts: 2
|
|
Back to top |
|
 |
anotheregglover Voice
Joined: 13 Jan 2005 Posts: 38
|
Posted: Sat Dec 17, 2005 6:23 pm Post subject: |
|
|
Can anyone suggest how to get the script to output a single line 'nothing found' type error rather than all the regular multiline info categories with N/A.
!imdb Asylum (2005)
[BOT] IMDb Title Search - http://www.imdb.com/
[BOT] Genre: N/A
[BOT] Tagline: N/A
[BOT] Synopsis: N/A
[BOT] Rating: N/A (N/A votes) top/bottom:N/A
[BOT] Runtime: N/A mins.
Thanks. |
|
Back to top |
|
 |
demond Revered One

Joined: 12 Jun 2004 Posts: 3073 Location: San Francisco, CA
|
Posted: Sat Dec 17, 2005 9:24 pm Post subject: |
|
|
by catching first N/A and skipping further output of such? _________________ connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use [code] tag when posting logs, code |
|
Back to top |
|
 |
v00j00 Voice
Joined: 18 Dec 2005 Posts: 4
|
Posted: Mon Dec 19, 2005 6:30 pm Post subject: |
|
|
Yea, the N/A results is not very appealing.. but how do you catch the result and get rid of it? |
|
Back to top |
|
 |
demond Revered One

Joined: 12 Jun 2004 Posts: 3073 Location: San Francisco, CA
|
Posted: Tue Dec 20, 2005 12:13 am Post subject: |
|
|
v00j00 wrote: | Yea, the N/A results is not very appealing.. but how do you catch the result and get rid of it? |
Code: |
foreach line [split $output] {
if [regexp N/A $line] continue
# show output
}
|
_________________ connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use [code] tag when posting logs, code |
|
Back to top |
|
 |
Luniz2k1 Voice
Joined: 17 Sep 2003 Posts: 19
|
Posted: Thu Jan 05, 2006 6:12 pm Post subject: Not working |
|
|
imdb.tcl:
Code: | ###############################################################################
## This iMDB.tcl requires Eggdrop1.6.0 or higher ##
## (c) 2003 by B0unTy ##
## ##
## changed by OV2 ##
## 31.08.2005: ##
## *changed search result priority again: ##
## 1. popular match where the title=search string ##
## 2. exact matches ##
## 3. first title on page ##
## *fixed missig warn_msg var ##
## ##
## until 24.06.2005: ##
## *works with new IMDB ##
## *works with (hopefully) all search results (popular/exact/partial) ##
## +added timeouts (20secs) ##
## +added bottom 100 support ##
## +added rating bar from chilla's imdb-script ##
## +added flood control ##
## *small speedup (if your output does not include %screens or %budget ##
## *changed proc name to improve compatibility with other scripts ##
## *changed search result priority to {exact->first displayed} ##
## ##
###############################################################################
## ##
## INSTALL: ##
## ======== ##
## 1- Copy iMDB.tcl in your dir scripts/ ##
## 2- Add iMDB.tcl in your eggdrop.conf: ##
## source scripts/imdb.tcl ##
## ##
## For each channel you want users to use !imdb cmd ##
## Just type in partyline: .chanset #channel +imdb ##
## ##
###############################################################################
# COOKIES ARE :
# =============
# TITLE = %title | BOLD = %bold
# URL = %url | UNDERLINE = %uline
# DIRECTOR = %name | COLORS = %color#,#
# GENRE = %genre | NEW LINE = \n
# SYNOPSIS = %plot |-----------------------------
# RATING = %rating | !! to reset color code !!
# RATING_BAR = %rbar | !! use %color w/o args !!
# VOTES = %votes |
# RUNTIME = %time |
# BUDGET = %budget |
# SCREENS = %screens |
# TAGLINE = %tagline |
# MPAA = %mpaa |
# COUNTRY = %country |
# LANGUAGE = %language |
# SOUND MIX = %soundmix |
# TOP 250 = %top250 |
#
# RANDOMIZING OUTPUT :
# ====================
# Exemple:
# set random(IMDBIRC-0) "IMDB info for %bold%title%bold Directed by %name"
# set random(IMDBIRC-1) "IMDB info for %title Directed by %bold%name%bold"
# set random(IMDBIRC-2) "IMDB info for %title Directed by %name"
# TYPE --------^ ^
# ID --------^
#
# set announce(IMDBIRC) "random 3"
# TYPE ---------^ ^ ^
# RANDOM ----------^ ^
# # OF IDS ---------^
#
# exemple random announces:
# set announce(IMDBIRC) "random 3"
# set random(IMDBIRC-0) "IMDB info for %bold%title%bold Directed by %name -> rated %uline%rating%uline (%votes votes) - genre: %genre - runtime: %time mins >> URL: %uline%url%uline >> Budget: %budget >> Screens: (USA) %screens"
# set random(IMDBIRC-1) "TITLE: %bold%title%bold - DIRECTOR: %name - RATE: %rating by %votes users - GENRE: %genre - RUNTIME: %time mins - URL: %url - BUDGET: %budget - SCREENS: (USA) %screens"
# set random(IMDBIRC-2) "%bold%title%bold - %url\n%boldDirected by:%bold %name\n%boldGenre:%bold %genre\n%boldTagline:%bold %tagline\n%boldSynopsis:%bold %plot\n%boldRating:%bold %rating (%votes votes) top 250:%bold%top250%bold\n%boldMPAA:%bold %mpaa\n%boldRuntime:%bold %time mins.\n%boldCountry:%bold %country\n%boldLanguage:%bold %language\n%boldSound Mix:%bold %soundmix\n%boldBudget:%bold %budget \n%boldOpening Weekend:%bold (USA) %screens"
# exemple normal announce:
set announce(IMDBIRC) "%bold%title%bold - %url\nGenre: %genre\nTagline: %tagline\nSynopsis: %plot\nRating: %rating (%votes votes) %rbar %color3%top250%color\nRuntime: %time mins."
#rating bar color
#bracket
set barcol1 "14"
#stars
set barcol2 "7"
#http connection timeout (milliseconds)
set imdb_timeout "20000"
#flood-control
set queue_enabled 1
#max requests
set queue_size 5
#per ? seconds
set queue_time 120
# for a channel !imdb request
# set to 1 = all results will be sent publicly to the channel
# set to 0 = all results will be sent as private notice
set pub_or_not 1
# use or not the imdb debugger (1=enable debug 0=disable debug)
set IMDB_DEBUG 1
# set IMDB_ALTERNATIVE 0 = use the internal tcl http 2.3 package
# set IMDB_ALTERNATIVE 1 = use the external curl 6.0+
set IMDB_ALTERNATIVE 0
# set here the location path where find curl 6.0+
set binary(CURL) ""
#################################################################
# DO NOT MODIFY BELOW HERE UNLESS YOU KNOW WHAT YOU ARE DOING! #
#################################################################
if { $IMDB_ALTERNATIVE == 0 } { package require http 2.3 }
setudef flag imdb
bind pub -|- !imdb imdb_proc
set instance 0
set warn_msg 0
proc htmlcodes {tempfile} {
set mapfile [string map {" ' & & [ ( \ / ] ) { ( } ) £ £ ¨ ¨ © © « « ® ® } $tempfile]
set mapfile [string map {´ ´ · · ¹ ¹ » » ¼ ¼ ½ ½ ¾ ¾ À À Á Á Â Â } $mapfile]
set mapfile [string map {Ã Ã Ä Ä Å Å Æ Æ Ç Ç È È É É Ê Ê Ë Ë Ì Ì Í Í Î Î Ï Ï Ð Ð Ñ Ñ Ò Ò Ó Ó Ô Ô Õ Õ Ö Ö } $mapfile]
set mapfile [string map {× × Ø Ø Ù Ù Ú Ú Û Û Ü Ü Ý Ý Þ Þ ß ß à à á á â â ã ã ä ä å å æ æ ç ç è è é é ê ê } $mapfile]
set mapfile [string map {ë ë ì ì í í î î ï ï ð ð ñ ñ ò ò ó ó ô ô õ õ ö ö ÷ ÷ ø ø ù ù ú ú û û ü ü ý ý þ þ } $mapfile]
return $mapfile
}
proc channel_check_imdb { chan } {
foreach setting [channel info $chan] {
if {[regexp -- {^[\+-]} $setting]} {
if {![string compare "+imdb" $setting]} {
set permission 1
break
} else {
set permission 0
}
}
}
return $permission
}
proc replacevar {strin what withwhat} {
set output $strin
set replacement $withwhat
set cutpos 0
while { [string first $what $output] != -1 } {
set cutstart [expr [string first $what $output] - 1]
set cutstop [expr $cutstart + [string length $what] + 1]
set output [string range $output 0 $cutstart]$replacement[string range $output $cutstop end]
}
return $output
}
proc imdb_proc { nick uhost handle chan arg } {
global instance queue_size queue_time queue_enabled imdb_timeout barcol1 barcol2 IMDB_DEBUG pub_or_not announce random warn_msg binary IMDB_ALTERNATIVE
# channel_check permission
set permission_result [channel_check_imdb $chan]
if {$IMDB_DEBUG == 1} { putlog "IMDB_DEBUG permission_result == $permission_result" }
if {$IMDB_DEBUG == 1} { putlog "IMDB_DEBUG instance == $instance" }
if { $permission_result == 0} { return }
# public or private
if {$pub_or_not == 1 } { set toput "PRIVMSG $chan" } else { set toput "NOTICE $nick" }
if {$IMDB_DEBUG == 1} { putlog "IMDB_DEBUG toput_result == $toput" }
# if no arg passed, show help
if {$arg == ""} {
if { $IMDB_ALTERNATIVE == 0 } { set using "Http 2.3+" } else { set using "Curl 6.0+" }
if {$IMDB_DEBUG == 1} { putlog "IMDB_DEBUG no arg passed, show help" }
puthelp "$toput :IMDb info script \002v2.3.4+\002 by B0unTy using \002$using\002"
puthelp "$toput :\002Syntax: !imdb <movie title>\002 exemple: !imdb Beautiful Mind"
return
}
#flood-control
if { $queue_enabled == 1 } {
#flooded?
if { $instance >= $queue_size } {
if {$IMDB_DEBUG == 1} { putlog "IMDB_DEBUG flood detected" }
if { $warn_msg == 0 } {
set warn_msg 1
putquick "$toput :Flood-Control: Request for \"$arg\" from user \"$nick\" will not be answered."
putquick "$toput :Flood-Control: Maximum of $queue_size requests every $queue_time seconds."
utimer 120 wmsg
}
return
}
incr instance
if { $IMDB_DEBUG == 1 } { putlog "IMDB_DEBUG new instance == $instance" }
utimer [set queue_time] decr_inst
}
# initial search
set imdburl "http://www.imdb.com"
set imdbsearchurl "http://akas.imdb.com/find?tt=on;nm=on;mx=5;"
set searchString [string map {\ %20 & %26 , %2C . %20} $arg]
if {$IMDB_DEBUG == 1} { putlog "IMDB_DEBUG searchString: \"$searchString\"" }
if { $IMDB_ALTERNATIVE == 0 } {
set page [::http::config -useragent "MSIE 6.0"]
if {$IMDB_DEBUG == 1} { putlog "IMDB_DEBUG ${imdbsearchurl}q=$searchString" }
set page [::http::geturl ${imdbsearchurl}q=$searchString -timeout $imdb_timeout]
if { [::http::status $page] == "timeout" } {
puthelp "$toput :\002Connection to imdb.com timed out while doing initial search.\002"
::http::Finish $page
return
}
set html [::http::data $page]
::http::Finish $page
} else {
catch { exec $binary(CURL) "${imdbsearchurl}q=$searchString" } html
}
#if redirect necessary, find first link and redirect
if { [regexp {<title>IMDb Search} $html] == 1 } {
if {$IMDB_DEBUG == 1} { putlog "IMDB_DEBUG redirect 1" }
set ttcode "0000001"
set start "0"
#start from the headline
regexp -indices {<h1>IMDb Search</h1>} $html start
set temp [string range $html [lindex $start 1] end]
#dealing with different search results
set hit 0
if { [regexp -indices {Popular Titles} $temp tstart] } {
if {$IMDB_DEBUG == 1} { putlog "IMDB_DEBUG found popular titles" }
set temp2 [string range $temp [lindex $tstart 1] end]
regexp {<a.*?>(.*?)</a>} $temp2 dummy title
if {$IMDB_DEBUG == 1} { putlog "IMDB_DEBUG compare $title == $arg" }
if { [string equal -nocase $title $arg] } {
if {$IMDB_DEBUG == 1} { putlog "IMDB_DEBUG equals - displaying first popular match" }
set temp $temp2
set hit 1
} else {
if {$IMDB_DEBUG == 1} { putlog "IMDB_DEBUG not equal - searching for exact match" }
}
}
if { $hit == 0 } {
if { [regexp -indices {Exact Matches} $temp start] } {
if {$IMDB_DEBUG == 1} { putlog "IMDB_DEBUG displaying exact match" }
} elseif { [regexp -indices {Titles} $temp start] } {
if {$IMDB_DEBUG == 1} { putlog "IMDB_DEBUG no exact match - displaying first title on page" }
} else {
puthelp "$toput :No useful results."
if {$IMDB_DEBUG == 1} { putlog "IMDB_DEBUG no titles results found" }
return
}
set temp [string range $temp [lindex $start 1] end]
}
#searching for first ttcode
if [regexp {/title/tt[0-9]+} $temp ttcode] {
set pos [string last / $ttcode] ; incr pos
set ttcode [string range $ttcode $pos end]
}
# for bogus ttcode
if { $ttcode == "0000001" } {
puthelp "$toput :No no no! I can't find that!"
if {$IMDB_DEBUG == 1} { putlog "IMDB_DEBUG bogus ttcode" }
return
}
set newurl "$imdburl/title/$ttcode/"
if {$IMDB_DEBUG == 1} { putlog "IMDB_DEBUG redirect 1 = $newurl" }
# get the page redirected to
unset html
if { $IMDB_ALTERNATIVE == 0 } {
set page [::http::config -useragent "MSIE 6.0"]
set page [::http::geturl $newurl -timeout $imdb_timeout]
if {[::http::status $page]=="timeout"} {
puthelp "$toput :\002Connection to imdb.com timed out.\002"
::http::Finish $page
return
}
set html [::http::data $page]
::http::Finish $page
} else {
catch { exec $binary(CURL) "$newurl" } html
}
# if no redirect happened, then get first page on match
} else {
set location ""
if {$IMDB_DEBUG == 1} { putlog "IMDB_DEBUG redirect 0" }
if { $IMDB_ALTERNATIVE == 0 } {
upvar 0 $page oldpage
regexp {title/tt[0-9]+/} $oldpage(meta) location
} else {
set result [catch { exec $binary(CURL) -i "${imdbsearchurl}q=$searchString" } oldpage]
regexp {title/tt[0-9]+/} $oldpage location
}
if {$IMDB_DEBUG == 1} { putlog "IMDB_DEBUG redirect 0 Location == $location" }
set newurl "$imdburl/$location"
if {$IMDB_DEBUG == 1} { putlog "IMDB_DEBUG redirect 0 = $newurl" }
if { $location != "" } {
if { $IMDB_ALTERNATIVE == 0 } {
unset html
set page [::http::config -useragent "MSIE 6.0"]
set page [::http::geturl $newurl -timeout $imdb_timeout]
if {[::http::status $page]=="timeout"} {
puthelp "$toput :\002Connection to imdb.com timed out.\002"
::http::Finish $page
return
}
set html [::http::data $page]
::http::Finish $page
} else {
unset html
catch { exec $binary(CURL) "$newurl" } html
}
}
}
# for bogus searches
if {[string length $newurl] == 0} {
puthelp "$toput :No no no! I can't find that!"
if {$IMDB_DEBUG == 1} { putlog "IMDB_DEBUG bogus searches" }
return
}
# decide on output
if { ! [string compare [lindex $announce(IMDBIRC) 0] "random"] && [string is alnum -strict [lindex $announce(IMDBIRC) 1]] == 1 } {
set output $random(IMDBIRC\-[rand [lindex $announce(IMDBIRC) 1]])
} else {
set output $announce(IMDBIRC)
}
# collect output
set title "N/A" ; set name "N/A" ; set genre "N/A" ; set tagline "N/A"
set plot "N/A" ; set rating "N/A" ; set votes "N/A" ; set mpaa "N/A"
set runtime "N/A" ; set budget "N/A" ; set screens "N/A" ; set country "N/A"
set language "N/A" ; set soundmix "N/A" ; set top250 "top/bottom:N/A"
set rating_bar ""
## get title
if [regexp {<title>[^<]+} $html title] {
set pos [expr [string last > $title] + 1]
set title [string range $title $pos end]
set title [htmlcodes $title]
}
if {$IMDB_DEBUG == 1} { putlog "IMDB_DEBUG title == $title" }
## get director
if [regexp {Directed by</b><br>\n<[^>]+>[^<]+} $html name] {
set pos [string last > $name] ; incr pos
set name [string range $name $pos end]
set name [htmlcodes $name]
}
if {$IMDB_DEBUG == 1} { putlog "IMDB_DEBUG director == $name" }
## get genre
if [regexp {<a href=./Sections/Genres[^\n]+} $html genre] {
regsub -all {<[^\>]*>} $genre {} genre
regsub {\(.*\)} $genre {} genre
}
if {$IMDB_DEBUG == 1} { putlog "IMDB_DEBUG genre == $genre" }
## get tagline
if [regexp {<b class="ch">Tagline:</b>[^<]+} $html tagline] {
set pos [string last > $tagline] ; incr pos
set tagline [string range $tagline $pos end]
set tagline [string trim $tagline]
set tagline [htmlcodes $tagline]
}
if {$IMDB_DEBUG == 1} { putlog "IMDB_DEBUG tagline == $tagline" }
## get plot
if [regexp {<b class=\"ch\">Plot (Summary|Outline):</b>[\s\n]+[^<]+} $html plot] {
set pos [string last > $plot] ; incr pos
set plot [string range $plot $pos end]
set plot [string trim $plot]
set plot [htmlcodes $plot]
}
if {$IMDB_DEBUG == 1} { putlog "IMDB_DEBUG plot == $plot" }
## get iMDb rating
if [regexp {<b>\d.\d/10</b> \([\w\s\d,]+\)} $html rating] {
set pos [string last ( $rating]
set pos1 [string first { } $rating $pos]
incr pos ; incr pos1 -1
set votes [string range $rating $pos $pos1]
set rating [string range $rating 3 8]
#rating bar code
set goldstars [regexp -all goldstar $html]
set greystars [expr 10 - $goldstars]
# generating the rating bar
set marker "*"
set rating_bar "$barcol1\[$barcol2"
for {set i2 0} {$i2 < $goldstars} {incr i2 1} {
set rating_bar "$rating_bar$marker"
}
set marker "-"
set rating_bar "$rating_bar14"
for {set i3 0} {$i3 < $greystars} {incr i3 1} {
set rating_bar "$rating_bar$marker"
}
set rating_bar "$rating_bar$barcol1\]"
#end rating bar code
}
if {$IMDB_DEBUG == 1} { putlog "IMDB_DEBUG rating == $rating | votes == $votes | rating bar == $rating_bar" }
## get TOP 250
if [regexp {<a href="/top_250_films">[^\n]+} $html top250] {
regexp {#[^<]+} $top250 top250
set top250 "top 250:$top250"
} elseif [regexp {<a href="/bottom_100_films">[^\n]+} $html top250] {
regexp {#[^<]+} $top250 top250
set top250 "bottom 100:$top250"
}
if {$IMDB_DEBUG == 1} { putlog "IMDB_DEBUG top250 == $top250" }
## get MPAA
if [regexp {<b class="ch"><a href="/mpaa">[^\n]+} $html mpaa] {
regsub -all {<[^\>]*>} $mpaa {} mpaa
regsub {MPAA: } $mpaa {} mpaa
set mpaa [htmlcodes $mpaa]
}
if {$IMDB_DEBUG == 1} { putlog "IMDB_DEBUG mpaa == $mpaa" }
## get runtime
if [regexp {<b class=\"ch\">Runtime:</b>([\n\s]+)([\w:]+)(\d+)} $html runtime] {
regsub -all {[\n\s]+} $runtime {} runtime
set pos [string last > $runtime] ; incr pos
set runtime [string range $runtime $pos end]
set pos [string last : $runtime]
if {$pos != -1} {incr pos ; set runtime [string range $runtime $pos end]}
}
if {$IMDB_DEBUG == 1} { putlog "IMDB_DEBUG runtime == $runtime" }
## get country
if [regexp {<a href=./Sections/Countries[^\n]+} $html country] {
regsub -all {<[^\>]*>} $country {} country
}
if {$IMDB_DEBUG == 1} { putlog "IMDB_DEBUG country == $country" }
## get language
if [regexp {<a href=./Sections/Languages[^\n]+} $html language] {
regsub -all {<[^\>]*>} $language {} language
}
if {$IMDB_DEBUG == 1} { putlog "IMDB_DEBUG language == $language" }
## get soundmix
if [regexp {<a href=./List.sound-mix=[^\n]+} $html soundmix] {
regsub -all {<[^\>]*>} $soundmix {} soundmix
}
if {$IMDB_DEBUG == 1} { putlog "IMDB_DEBUG soundmix == $soundmix" }
# do we need the second page?
if {[string match "*%budget*" $output] || [string match "*%screens*" $output]} {
if {$IMDB_DEBUG == 1} { putlog "IMDB_DEBUG page2 needed" }
unset html
if { $IMDB_ALTERNATIVE == 0 } {
set page2 [::http::config -useragent "MSIE 6.0"]
set page2 [::http::geturl ${newurl}business -timeout $imdb_timeout]
if {[::http::status $page2]=="timeout"} {
puthelp "$toput :\002Connection to imdb.com timed out.\002"
::http::Finish $page2
return
}
set html [::http::data $page2]
::http::Finish $page2
} else {
catch { exec $binary(CURL) "${newurl}business" } html
}
## get budget
if [regexp {<b>Budget</b></dt>[\s\n]?<dd><[^>]+>[^<]+} $html budget] {
set pos [string last > $budget] ; incr pos
set budget [string range $budget $pos end]
set budget [string map {€ € £ £ } $budget]
}
if {$IMDB_DEBUG == 1} { putlog "IMDB_DEBUG budget == $budget" }
## get screens
if [regexp {<b>Opening Weekend</b></dt>[\s\n]?[^\n]+} $html opweek] {
if [regexp {\(USA\) \([^)]+\) \([^)]+\)} $opweek screens] {
set pos [string last ( $screens]
set pos1 [string last ) $screens]
incr pos ; incr pos1 -1
set screens [string range $screens $pos $pos1]
}
}
if {$IMDB_DEBUG == 1} { putlog "IMDB_DEBUG screens == $screens" }
}
## output results
set output [replacevar $output "%bold" "\002"]
set output [replacevar $output "%color" "\003"]
set output [replacevar $output "%uline" "\037"]
set output [replacevar $output "%title" $title]
set output [replacevar $output "%url" $newurl]
set output [replacevar $output "%name" $name]
set output [replacevar $output "%genre" $genre]
set output [replacevar $output "%tagline" $tagline]
set output [replacevar $output "%plot" $plot]
set output [replacevar $output "%rating" $rating]
set output [replacevar $output "%rbar" $rating_bar]
set output [replacevar $output "%votes" $votes]
set output [replacevar $output "%top250" $top250]
set output [replacevar $output "%mpaa" $mpaa]
set output [replacevar $output "%time" $runtime]
set output [replacevar $output "%country" $country]
set output [replacevar $output "%language" $language]
set output [replacevar $output "%soundmix" $soundmix]
set output [replacevar $output "%budget" $budget]
set output [replacevar $output "%screens" $screens]
foreach line [split $output "\n"] {
puthelp "$toput :$line"
}
}
proc decr_inst { } {
global IMDB_DEBUG instance
if { $instance > 0 } { incr instance -1 }
if { $IMDB_DEBUG == 1 } { putlog "IMDB_DEBUG instance decreased by timer to: $instance" }
}
proc wmsg { } {
global warn_msg
set warn_msg 0
}
putlog "IMDB info version {31.08.2005} loaded" |
-------------------------------
bot log:
Code: | [16:50] IMDB_DEBUG permission_result == 1
[16:50] IMDB_DEBUG instance == 1
[16:50] IMDB_DEBUG toput_result == PRIVMSG #test
[16:50] IMDB_DEBUG new instance == 2
[16:50] IMDB_DEBUG searchString: "Contact"
[16:50] IMDB_DEBUG http://akas.imdb.com/find?tt=on;nm=on;mx=5;q=Contact
[16:50] IMDB_DEBUG redirect 1
[16:50] IMDB_DEBUG found popular titles
[16:50] IMDB_DEBUG compare Contact == Contact
[16:50] IMDB_DEBUG equals - displaying first popular match
[16:50] IMDB_DEBUG redirect 1 = http://www.imdb.com/title/tt0118884/
[16:50] IMDB_DEBUG title == Contact (1997)
[16:50] IMDB_DEBUG director == Robert Zemeckis
[16:50] IMDB_DEBUG genre == Drama / Sci-Fi / Mystery
[16:50] IMDB_DEBUG tagline == From the Academy Award-winning director of 'Forrest Gump' and Pulitzer Prize-winning author of 'Contact' take you on a journey to the heart of the $
[16:50] IMDB_DEBUG plot == Dr. Ellie Arroway, after years of searching, finds conclusive radio proof of intelligent aliens, who send plans for a mysterious machine.
[16:50] IMDB_DEBUG rating == 7.3/10 | votes == 40,193 | rating bar == ^C14[^C7********^C14--^C14]^C
[16:50] IMDB_DEBUG top250 == top/bottom:N/A
[16:50] IMDB_DEBUG mpaa == Rated PG for some intense action, mild language and a scene of sensuality.
[16:50] IMDB_DEBUG runtime == 153
[16:50] IMDB_DEBUG country == USA
[16:50] IMDB_DEBUG language == English / Spanish / German
[16:50] IMDB_DEBUG soundmix == DTS / Dolby Digital / SDDS |
---------------------------------
But no output in the channel.
And yes, ".chanset #test +imdb" was done on the bot.
So any ideas?
eggdrop v1.6.17+SSL
OS: Linux 2.6.12-1.1381_FC3
Tcl library: /usr/share/tcl8.4
Tcl version: 8.4.7 (header version 8.4.7) |
|
Back to top |
|
 |
|