Mise en forme de code: pensez à utiliser les balises [ tcl ] et [ /tcl ] (sans les espaces bien sûr) autour de vos codes tcl afin d'avoir un meilleur rendu et une coloration syntaxique. x


[Script] "::http::register https 443 ::tls::socket"
#1
Bonjour a tous,

Je suis nouveau dans le monde des eggdrops et le langage de programmation Tcl.
Version de mon eggdrop : Eggdrop v1.8.4
J'ai configure l'eggdrop avec un peu de mal mais il fonctionne bien que je n'est acces a la party line uniquement par telnet, impossible d'y accede par dcc.
Cela pour l'instant ne me derange pas plus que ca.
Par contre j'ai recupere un script imdb.tcs qui lorsque je lance mon eggdrop le fait planter avec l'erreur suivante

invalid command name "::http::register"
    while executing
"::http::register https 443 ::tls::socket"

Voici la partie du code qui pose probleme (c'est visiblement la gestion du tls)

#################################################################
# DO NOT MODIFY BELOW HERE UNLESS YOU KNOW WHAT YOU ARE DOING!  #
#################################################################
if { $IMDB_ALTERNATIVE == 0 } { package require http 2.3 }

set packages(tls) [catch {package require tls}]; # https


::http::register https 443 ::tls::socket

J'ai fait quelques recherches sur internet mais sans succes
Merci d'avance pour votre aide.
#2
Bienvenu dans le monde des eggdrops.

Il faudrait voir le script en entier, mais l'erreur ressemble à l'absence du chargement du package http. Donc, $IMDB_ALTERNATIVE qui n'est pas égal à 0.

Et pour ton problème de DCC, essaye en passant par le ctcp. Et c'est probablement dû à une mauvaise configuration de l'eggdrop (côté infos du réseau). Si l'eggdrop est hébergé chez toi, ça peut aussi venir de la box (ouverture de port, translation d'adresse, ...)
Zeolia - Offrez-moi un café
Merci de ne pas demander d'aide en MP
Away
#3
Bonjour CrazyCat,

Merci de m'avoir repondu aussi rapidement.
Concernant le script je le posterai ce soir, il est vrai que j'aurais du le faire des mon premier post
Concernant le dcc, l'eggdrop est heberge sur un vps. J' aussi essaye de passer par un ctcp ca ne fonctionne pas non plus
Par contre je vais quand meme essayer ce soir de faire un dcc avec une personne sur le channel, c'est peut etre mon irc qui est mal parametre.
A ce soir et merci de ton aide
#4
Voici le script imdb.tcl
En fichier joint je n'ai pas l'impression que ca marche


Code:
###############################################################################
##     This iMDB.tcl requires Eggdrop1.6.0 or higher                         ##
##                  (c) 2003 by B0unTy                                       ##
##     ##
##                                                                           ##
##  changed by outz                                                          ##
##  19.04.2018                                                               ##
##  * imdb now requires https/tls - added support in the script.             ##
##  requires tcl tls package                                                 ##
##                                                                           ##
##  changed by outz                                                          ##
##  05.01.2018                                                               ##
##  * original search url akas.imdb.com seems to no longer exist.            ##
##  i've changed it to www.imdb.com to restore search functionality.         ##
##                                                                           ##
##  changed by outz             ##
##  14.12.2017     ##
##  * refined first match regex as it was pulling the current promoted/ad    ##
##    movie and not the expected search result                               ##
##     ##
##  changed by sAnexeh                                                       ##
##  03.12.2016                                                               ##
##  * fixed infinite loop in %language introduced in 13.08.2016 version      ##
##                                                                           ##
##  changed by sAnexeh                                                       ##
##  13.08.2016                                                               ##
##  * applied trim on %country, %language and %soundmix                      ##
##  * removed extra spaces on %wcredits, %keywords, %country and %language   ##
##  * added spaces on %mcolor                                                ##
##  * fixed %company                                                         ##
##                                                                           ##
##  changed by sAnexeh                                                       ##
##  11.08.2016                                                               ##
##  * fixed %awards                                                          ##
##                                                                           ##
##  changed by sAnexeh                                                       ##
##  19.06.2016                                                               ##
##  * added Language_IP to get around IMDB's geolocation                     ##
##  * removed extra lookup for %comment to improve performance because       ##
##    the URL _ajax/footer pointed pointed to a 404, rendering %comment      ##
##  useless (probably already was for a while)                         ##
##  * added variable for User_Agent in imdb_proc te remove inconsistency     ##
##  * replaced comma with dot in %rating to allow round to work properly     ##
##    in the case of European math formats                                   ##
##                                                                           ##
##  changed by sAnexeh                                                       ##
##  25.03.2016                                                               ##
##  * fixed %budget, %rating and %votes                                      ##
##                                                                           ##
##  changed by sAnexeh                                                       ##
##  22.04.2014                                                               ##
##  * prevent unwanted newlines after pipe character (|) on %genre           ##
##                                                                           ##
##  changed by sAnexeh                                                       ##
##  05.12.2013                                                               ##
##  * changed regexp causing incorrect search results due to introduced ads  ##
##                                                                           ##
##  19.01.2013                                                               ##
##  * changed by gr11x imdbsearchurl due to imdb's site modification         ##
##  * changed by spithash fixed issue with                                   ##
##   Tcl error [imdb_proc]: can't read "permission_result": no such variable"##
##                                                                           ##
##  changed by username and caesar                                           ##
##  19.03.2012                                                               ##
##  * some random code trimming by username and caesar                       ##
##                                                                           ##
##  changed by username                                                      ##
##  16.03.2012                                                               ##
##  * changed the anti-flood protection, it was malfunctioning and it's now  ##
##    replaced with a new throttle control.                                  ##
##                                                                           ##
##  changed by spithash                                                      ##
##  30.09.2011                                                               ##
##  * Fixed rating cause imdb's website has changed a little bit             ##
##  * Changed the default theme of 'set announce(IMDBIRC)' to my needs.      ##
##    Don't get nasty if it doesn't look like the old/default one.           ##
##    You can change it back to how you had it using your previous version.  ##
##                                                                           ##
##  changed by znuff                                                         ##
##  23.08.2011                                                               ##
##  * Fixed parse of multiple cookies (release date, rating, rbar, votes,    ##
##    title, runtime, awards, comments, mpaa, cert)                          ##
##  * Fixed color output for rbar                                            ##
##  * Set output to UTF-8 by default                                         ##
##  * Added a new cookie - bullet separator (%bull)                          ##
##  * Runtime cookie now includes the prefix "min"                           ##
##  * Changed default search url to akas.* to bypass the stupid localization ##
##    of the title                                                           ##
##  * Grabbing user comments makes another request to IMdb!                  ##
##  * What I didn't fix: company, cast_multiline, cast_ine, screens - they   ##
##    do produce output, but not the desired one, and I have no intention    ##
##    to fix                                                                 ##
##                                                                           ##
##  changed by username                                                      ##
##  19.10.2010                                                               ##
##  *fixed page parsing errors                                               ##
##                                                                           ##
##  changed by OV2                                                           ##
##  05.01.2010                                                               ##
##    *fixed remaining bugs with imdb changes                                ##
##                                                                           ##
##  02.01.2010                                                               ##
##    *modified for imdb page changes                                        ##
##                                                                           ##
##  16.09.2008                                                               ##
##    *modified for new imdb page                                            ##
##                                                                           ##
##  25.05.2008                                                               ##
##    *plot works again                                                      ##
##                                                                           ##
##  19.05.2008                                                               ##
##    *fixed the non-working cookies (cert, soundmix ...)                    ##
##    * "|" characters in cookies are displayed again                        ##
##                                                                           ##
##  21.09.2007                                                               ##
##    *multiline color/underline/bold were broken                            ##
##    +added single-line cast (%castline)                                    ##
##    +added the remaining information from imdb (color, cert, etc...)       ##
##                                                                           ##
##  17.07.2007                                                               ##
##    *fix for the exact title matching                                      ##
##    *exact name matches are no longer confused with exact title matches    ##
##                                                                           ##
##  27.06.2007                                                               ##
##    *works with new imdb search page                                       ##
##    *%uline works again                                                    ##
##                                                                           ##
##  09.04.2007:                                                              ##
##    *fixed director/s writer/s                                             ##
##    +added support for plot keywords                                       ##
##    +added support for user comment line                                   ##
##                                                                           ##
##  28.02.2007:                                                              ##
##    *ratings work again                                                    ##
##    *director and writing credits work again                               ##
##                                                                           ##
##  25.02.2007:                                                              ##
##    *fixed some bugs of the previous changes (thanks to rosc2112)          ##
##                                                                           ##
##  24.02.2007:                                                              ##
##    *bold/underline/color in front of the multiline cast will now be       ##
##     applied to each of the cast lines                                     ##
##    *the | character is now used to declare sections in the announce line  ##
##     if any variable in a section is not found on the imdb page, the       ##
##     corresponding section will not be displayed in the output             ##
##     (see the default announce line for an example)                        ##
##                                                                           ##
##  22.02.2007:                                                              ##
##    *incorporated some code from rosc2112's version                        ##
##    *some small fixes                                                      ##
##                                                                           ##
##  20.02.2007:                                                              ##
##    *changed regexp queries to accomodate the new imdb layout              ##
##    *cleaned up the unneccesary post-regexp code                           ##
##                                                                           ##
##  14.05.2006:                                                              ##
##    *fixed plot outline not showing completely if it included links        ##
##      (thanks to darkwing for finding the bug)                             ##
##    +added support for awards (thanks to rosc2112)                         ##
##    +added support for the cast list (be careful with the limit)           ##
##    +added support for writing credits                                     ##
##                                                                           ##
##  21.01.2006:                                                              ##
##    *fixed problem with irregular search-result pages from imdb            ##
##                                                                           ##
##  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
# PLOT OUTLINE      = %plot                |-----------------------------
# RATING            = %rating              |    !! to reset color code !!
# RATING_BAR        = %rbar                |    !! use %color w/o args !!
# VOTES             = %votes               |
# RUNTIME           = %time (incl. "min")  |    "|" declares a section
# AWARDS            = %awards              |    if any cookie in a section
# BUDGET            = %budget              |    is empty the whole section
# SCREENS           = %screens             |    is removed from the output
# TAGLINE           = %tagline             |    (end section with "|")
# MPAA              = %mpaa                |
# COUNTRY           = %country             |
# LANGUAGE          = %language            |
# SOUND MIX         = %soundmix            |
# TOP 250           = %top250              |
# CAST LINES        = %castmline           |
# CAST SNGLELINE    = %castline            |
# WRITING CREDITS   = %wcredits            |
# PLOT KEYWORDS     = %keywords            |
# COMMENT LINE      = %comment             |
# RELEASE DATE      = %reldate             |
# MOVIE COLOR       = %mcolor              |
# ASPECT RATIO      = %aspect              |
# CERTIFICATION     = %cert                |
# LOCATIONS         = %locations           |
# COMPANY           = %company             |
#
# + 19.10.2010
# Also Known As     = %aka
# + 23.8.2011
# BULLET (separator)= %bull
#
# 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 announce(IMDBIRC) "%bold%title%bold %color4-%color %url %color4-%color %boldDirected by:%bold %name %color4-%color %boldGenre:%bold %genre %color4-%color %boldRelease Date:%bold %reldate %color4-%color %boldBudget:%bold %budget %color4-%color %boldScreens:%bold %screens %color4-%color %boldRating:%bold%color7 %rating/10 %rbar %color14(%color3 %votes votes\%color14 )\n%boldPlot:%bold %plot%bold %color4-%color %boldRuntime:%bold %time."
# example normal announce:
# set announce(IMDBIRC) "\[%bold%title%bold\] \[%boldGenre:%bold %genre\] \[%boldTagline:%bold %tagline\] \[%boldRuntime:%bold %time mins\] \[%boldReleasedate:%bold %reldate\] \[%boldRating:%bold %rating (%votes votes)\] \[%boldURL:%bold %uline%url%uline#\]"
# set announce(IMDBIRC) "%bold%title%bold - %url\n|Rating: %rating (%votes votes) %rbar| |%top250|\n|%plot|"
# set announce(IMDBIRC) "%bold%title%bold |\[%time mins - %mcolor\]| - %url\n|Genre: %genre|\n|Tagline: %tagline|\n|Synopsis: %plot|\n|Rating: %rating (%votes votes) %rbar| |%color3%top250%color|\n|Awards: %awards|"
# set announce(IMDBIRC) "%bold%title%bold - %url\n|%boldGenre:%bold %genre|\n|Plot Keywords: %keywords|\n|Tagline: %tagline|\n|Synopsis: %plot|\n|Rating: %rating (%votes votes) %rbar| |%color3%top250%color|\n|Comment: %comment|\n|Awards: %awards|\n|Runtime: %time mins.|"
# old default announce format
# set announce(IMDBIRC) "%bold%title%bold %url\n|%boldRATiNG:%bold %rating/10 (from %votes users) %boldRUNTiME:%bold %time\n|%boldGENRE:%bold %genre"

# set default announce format
set announce(IMDBIRC) "\[%bold%title%bold\] \[%boldGenre:%bold %genre\] \[%boldTagline:%bold %tagline\] \[%boldRuntime:%bold %time mins\] \[%boldReleasedate:%bold %reldate\] \[%boldRating:%bold %rating (%votes votes)\] \[%boldURL:%bold %uline%url%uline#\]"

#trigger command in channel
set trigger ".imdb"

#rating bar color
#bracket
set barcol1 "14"
#stars
set barcol2 "7"
#cast count to return on multiline and single line (0 means no limit)
set cast_linelimit "0"

#http connection timeout (milliseconds)
set imdb_timeout "25000"

# Delay between command for each channel.
set delay 5

# 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 1

# set here the location path where find curl 6.0+
set binary(CURL) "/usr/bin/curl"
# note for windrop: use normal slashes, e.g. C:/path/to/curl.exe

# User Agent used to do lookup to imdb
set User_Agent "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3"

# Language IP-address to be used
# IMDb (and specifically www.imdb.com in this case) use your geolocation to define the language for the movie title
# Sites like http://www.nirsoft.net/countryip/ will allow you to find an IP for the language you prefer
# For example: set Language_IP "62.4.31.1" will result in French movie titles
# For example: set Language_IP "54.71.255.1" will result in English movie titles
# Leave empty if you want IMDb to use your geolocation for your language
set Language_IP ""

#################################################################
# DO NOT MODIFY BELOW HERE UNLESS YOU KNOW WHAT YOU ARE DOING!  #
#################################################################
if { $IMDB_ALTERNATIVE == 0 } { package require http 2.3 }

set packages(tls) [catch {package require tls}]; # https


::http::register https 443 ::tls::socket

setudef flag imdb

bind pub -|- $trigger imdb_proc

set instance 0
set warn_msg 0

proc htmlcodes {tempfile} {
#    set mapfile [string map {& & ' ' ' ' [ ( \ / ] ) { ( } )   " " ? ? ? ? © © « « ­ ­ ® ® ? ? ? ? } $tempfile]
#    set mapfile [string map {? ? · · ^(1) ^(1) » » 1/4 1/4 1/2 1/2 3/4 3/4 A` A` A' A' A^ A^ } $mapfile]
#    set mapfile [string map {A~ A~ A" A" A* A* ? ? C, C, E` E` E' E' E^ E^ E" E" I` I` I' I' I^ I^ I" I" ? ? N~ N~ O` O` O' O' O^ O^ O~ O~ O" O" } $mapfile]
#    set mapfile [string map {? ? ? ? U` U` U' U' U^ U^ U" U" Y' Y' ? ? ? ? a` a` a' a' a^ a^ a~ a~ a" a" a* a* ? ? c, c, e` e` e' e' e^ e^ } $mapfile]
#    set mapfile [string map {e" e" i` i` i' i' i^ i^ i" i" ? ? n~ n~ o` o` o' o' o^ o^ o~ o~ o" o" ? ? ? ? u` u` u' u' u^ u^ u" u" y' y' ? ? } $mapfile]
    set mapfile [string map {  "" & "&" " \"} $tempfile]
   return $mapfile
}

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 findnth {strin what count} {
    set ret 0
    for {set x 0} {$x < $count} {incr x} {
        set ret [string first $what $strin [expr $ret + 1]]
    }
    return $ret
}

proc imdb_proc { nick uhost handle chan arg } {
   global cast_linelimit instance delay imdb_timeout barcol1 barcol2 IMDB_DEBUG pub_or_not announce random warn_msg trigger binary IMDB_ALTERNATIVE
   variable imdb
   # channel_check permission
   # if {$IMDB_DEBUG == 1} { putlog "IMDB_DEBUG permission_result == $permission_result" }
   # if {$IMDB_DEBUG == 1} { putlog "IMDB_DEBUG instance == $instance" }
   # if {![channel get $chan imdb]} { 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 \002v30.09.2011\002 using \002$using\002"
       puthelp "$toput :\002Syntax: $trigger <movie title>\002 example: $trigger Beautiful Mind"
       return
   }

   #flood-control
   if {[info exists imdb(lasttime,$chan)] && [expr $imdb(lasttime,$chan) + $delay] > [clock seconds]} {
       putserv "NOTICE $nick :You can use only 1 command in $delay seconds. Wait [expr $delay - [expr [clock seconds] - $imdb(lasttime,$chan)]] seconds and try again."
       return 0
   }

   # initial search
   set imdburl "https://www.imdb.com"
   set imdbsearchurl "https://www.imdb.com/find?s=tt&exact=false&"
   set searchString [string map {\  %20 & %26 , %2C} $arg]
variable User_Agent
variable Language_IP
   if {$IMDB_DEBUG == 1} { putlog "IMDB_DEBUG searchString: \"$searchString\"" }
   if { $IMDB_ALTERNATIVE == 0 } {
       set page [::http::config -useragent $User_Agent]
       if {$IMDB_DEBUG == 1} { putlog "IMDB_DEBUG ${imdbsearchurl}q=$searchString" }
       if [catch {set page [::http::geturl ${imdbsearchurl}q=$searchString -headers [list X-FORWARDED-FOR $Language_IP] -timeout $imdb_timeout]} error] {
           puthelp "$toput :Error retrieving URL... try again later."
           ::http::Finish $page
           return
       }
       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 (search page), find first link and redirect
if { ([regexp {<title>Find - IMDb} $html] == 1) } {
       if {$IMDB_DEBUG == 1} { putlog "IMDB_DEBUG redirect 1" }
       set ttcode "0000001"
       set start "0"
       set temp $html

       #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 {1\..*?<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 {Titles \(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 {primary_photo\"\> \<a href\=\"/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 $User_Agent]
           set page [::http::geturl $newurl -headers [list X-FORWARDED-FOR $Language_IP] -timeout $imdb_timeout]
           if [catch {set page [::http::geturl $newurl -headers [list X-FORWARDED-FOR $Language_IP] -timeout $imdb_timeout]} error] {
               puthelp "$toput :Error retrieving URL... try again later."
               ::http::Finish $page
               return
          }
           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 necessary (only one match in meta), then go there
   } 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]
           putlog $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 $User_Agent]
               if [catch {set page [::http::geturl $newurl -headers [list X-FORWARDED-FOR $Language_IP] -timeout $imdb_timeout]} error] {
                   puthelp "$toput :Error retrieving URL... try again later."
                   ::http::Finish $page
                   return
               }
               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
           }
       } else {
           puthelp "$toput :Error in search mechanics - you probably need a newer version."
           return
       }
   }
   # grab footer content / user comment
   if { $newurl != "" } {

if { 1 == 2 } {
# no idea why this is here
     set part2 "_ajax/footer"
     set footerurl "$newurl$part2"

     if { $IMDB_ALTERNATIVE == 0 } {
        set page [::http::config -useragent $User_Agent]
        if [catch {set page [::http::geturl $footerurl -headers [list X-FORWARDED-FOR $Language_IP] -timeout $imdb_timeout]} error] {
           puthelp "$toput :Error retrieving URL... try again later."
           ::http::Finish $page
           return
        }
        if {[::http::status $page]=="timeout"} {
           puthelp "$toput :\002Connection to imdb.com timed out.\002"
           ::http::Finish $page
           return
        }
        set html2 [::http::data $page]
        ::http::Finish $page
        } else {
           catch { exec $binary(CURL) "$footerurl" } html2
        }
}


     } else {
        puthelp "$toput :Error in search mechanics - you probably need a newer version."
        return
     }    

   # 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 aka "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 awards "N/A"; set rating_bar ""; set cast_multiline "N/A"; set wcredits "N/A";
   set keywords "N/A"; set comment "N/A"; set reldate "N/A"; set cast_line "N/A"; set movie_color "N/A"; set aspect_ratio "N/A";
   set cert "N/A"; set film_locations "N/A"; set company "N/A"
 
   ## get title
   if [regexp {<title>[^<]+} $html title dummy] {
       set pos [expr [string first > $title] +1]
       set pos2 [expr [string first ) $title]]
       set title [string range $title $pos $pos2]
       set title [htmlcodes $title]
   }
   if {$IMDB_DEBUG == 1} { putlog "IMDB_DEBUG title == $title" }
   
   ## get aka
   if [regexp {<h4 class="inline">Also Known As:</h4>(.*?)</div>} $html dummy aka] {
       regsub -all {<[^\>]*>} $aka {} aka
       set aka [string map {"See more" "" \n "" &amp; " & " &raquo; ""} $aka]
       set aka [string trim $aka]
       set aka [htmlcodes $aka]
   }
   if {$IMDB_DEBUG == 1} { putlog "IMDB_DEBUG aka == $aka" }
 
   ## get director
   if [regexp {<h4 class="inline">.*?Director:.*?</h4>(.*?)</div>} $html dummy name] {
       regsub -all {\n[ ]*} $name {} name
       set name [string map {"&<br/>" "& " "<br/>" ", " "See more" ""} $name]
       regsub -all {<[^>]+>} $name {} name
       set name [string trim $name]
       regsub -all {,$} $name {} name
       set name [htmlcodes $name]
   }
   if {$IMDB_DEBUG == 1} { putlog "IMDB_DEBUG director == $name" }
   ## get writing credits
   if [regexp {<h4 class="inline">.*?Writers:.*?</h4>(.*?)</div>} $html dummy wcredits] {
       regsub -all {\n[ ]*} $wcredits {} wcredits
       set wcredits [string map {"See more" "" "<br/>&nbsp;" "" "&<br/>" "& " "&#x26;<br/>" "& " "<br/>" ", " "&raquo;" ""} $wcredits]
       regsub -all {<[^>]+>} $wcredits {} wcredits
       set wcredits [string trim $wcredits]
       regsub -all {,$} $wcredits {} wcredits
       while { [string first "  " $wcredits] != -1 } {
         set wcredits [string map {"  " " " } $wcredits]
       }
       set wcredits [htmlcodes $wcredits]
   }
   if {$IMDB_DEBUG == 1} { putlog "IMDB_DEBUG writer == $wcredits" }
   # release date
   if {[regexp {<h4 class="inline">Release Date:</h4>(.*?)<} $html dummy reldate]} {
       # regsub -all {<[^\>]*>} $reldate {} reldate
       set reldate [string trim $reldate]
       set reldate [htmlcodes $reldate]
   }
   if {$IMDB_DEBUG == 1} { putlog "IMDB_DEBUG release date == $reldate" }
   ## get genre
   if [regexp {<h4 class="inline">Genres:</h4>(.*?)</div>} $html dummy genre] {
       set genre [string map {"See more" "" &nbsp; " "} $genre]
       regsub -all {<[^\>]*>} $genre {} genre
       set genre [string map {"|" "||" } $genre]
set genre [string map {"\n" "" } $genre]
set genre [string map {" ||" "," } $genre]
# set genre [string map {"  " ", " } $genre]
# set genre [string map {"|" "," } $genre]
       set genre [string trim $genre]
       regsub {\(.*\)} $genre {} genre
   }
   if {$IMDB_DEBUG == 1} { putlog "IMDB_DEBUG genre == $genre" }
   ## get tagline
   if [regexp {<h4 class="inline">Taglines:</h4>(.*?)<} $html dummy tagline] {
       set tagline [string map {"See more" "" } $tagline]
       regsub -all {<[^\>]*>} $tagline {} tagline
       set tagline [string trim $tagline]
       set tagline [htmlcodes $tagline]
   }
   if {$IMDB_DEBUG == 1} { putlog "IMDB_DEBUG tagline == $tagline" }
   ## get plot outline
   if { [regexp {<h2>Storyline</h2>(.*?)<em .*?>} $html dummy plot] || [regexp {<h5>Plot Summary:</h5>(.*?)</div>} $html dummy plot] } {
       set plot [string map {"See more" "" "(view trailer)" "" "full summary" "" "add synopsis" "" "full synopsis (warning! may contain spoilers)" "" "full synopsis" "" " | " ""} $plot]
       regsub -all {<[^\>]*>} $plot {} plot
set plot [string trim $plot]
set plot [string range $plot 0 357]
       set plot [htmlcodes $plot]
   }
   if {$IMDB_DEBUG == 1} { putlog "IMDB_DEBUG plot == $plot" }
   ## get plot keywords
   if [regexp {<h4 class="inline">Plot Keywords:</h4>(.*?)</div>} $html dummy keywords] {
      set keywords [string map {"See more" "" \n "" &nbsp; " " &raquo; ""} $keywords]
      regsub -all {<[^\>]*>} $keywords {} keywords
      set keywords [string map {"|" "||"} $keywords]
      set keywords [string trim $keywords]
      set keywords [htmlcodes $keywords]
      while { [string first "  " $keywords] != -1 } {
         set keywords [string map {"  " " " } $keywords]
      }
   }
   if {$IMDB_DEBUG == 1} { putlog "IMDB_DEBUG keywords == $keywords" }
   ## get awards
   if [regexp {<span itemprop="awards">(.*?)<span class="see-more inline">} $html awards] {
      regsub -all {[\n]} $awards {} awards
      regsub -all {<[^\>]*>} $awards {} awards
      set awards [string map {"\n" "" } $awards]
      set awards [string map {"&amp;" "&" } $awards]
      while { [string first "  " $awards] != -1 } {
         set awards [string map {"  " " " } $awards]
      }
      set awards [string trim $awards]
      set awards [string trimright $awards "."]
      set awards [htmlcodes $awards]
   }
   if {$IMDB_DEBUG == 1} { putlog "IMDB_DEBUG awards == $awards" }
   ## get comment (does not seem to work because part2 points to _ajax/footer which results in a 404)
if {1 == 2} {
if [regexp {<div class="user-comments">.*?</strong>} $html2 comment] {
  regsub -all {[\n]} $comment {} comment
  set pos [expr [string first "<strong>" $comment] +8]
  set pos2 [expr [string first "</strong>" $comment] -9]
  set comment [string range $comment $pos $pos2]
  set comment [string trim $comment]
  set comment [htmlcodes $comment]
}
}
   if {$IMDB_DEBUG == 1} { putlog "IMDB_DEBUG comment == $comment" }
   ## get iMDb rating                                    
   if [regexp {<span itemprop="ratingValue">(.*?)</span></strong>} $html rating] {
       regsub -all {<[^\>]*>} $rating {} rating
       #rating bar code - attempt at recreating
set rating [string map {, .} "$rating"]
       set goldstars [expr round($rating)]
       set greystars [expr 10 - $goldstars]

       # generating the rating bar
       set marker "*"
       set rating_bar "%color$barcol1\[%color$barcol2"
       for {set i2 0} {$i2 < $goldstars} {incr i2 1} {
        set rating_bar "$rating_bar$marker"
       }
       set marker "-"
       set rating_bar "$rating_bar%color$barcol2"
       for {set i3 0} {$i3 < $greystars} {incr i3 1} {
           set rating_bar "$rating_bar$marker"
       }
       set rating_bar "$rating_bar%color$barcol1\]%color"
       #end rating bar code    
   }

   if [regexp {<span class="small" itemprop="ratingCount">(.*?)</span>} $html votes] {
       regsub -all {<[^\>]*>} $votes {} votes
   }

   #if [regexp {<b>((.*?)</b><span class="mellow">/10)</span>.*?<a .*? href="ratings".*?>(.*?) votes</a>} $html dummy rating goldstars votes] {
   #
   #    regsub -all {<[^\>]*>} $rating {} rating
   #    #rating bar code
   #    set goldstars [expr round($goldstars)]
   #    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_bar314"
   #    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 {<strong>Top 250 #([\d]+)</strong>} $html dummy top250] {
   } elseif [regexp {>(Bottom 100: #[\d]+)</a>} $html dummy top250] {
   }

   if {$IMDB_DEBUG == 1} { putlog "IMDB_DEBUG top250 == $top250" }
   ## get MPAA
   if [regexp {<span itemprop="contentRating">.*?</span>} $html mpaa] {
       regsub -all {<[^\>]*>} $mpaa {} mpaa
       set mpaa [string trim $mpaa]
       set mpaa [htmlcodes $mpaa]
   }
   if {$IMDB_DEBUG == 1} { putlog "IMDB_DEBUG mpaa == $mpaa" }
   ## get runtime
   if [regexp {<h4 class="inline">Runtime:</h4>.*?<time .*?>(.*?)min</time>} $html dummy runtime] {
       regsub -all {[\n\s]+} $runtime {} runtime
   }
   if {$IMDB_DEBUG == 1} { putlog "IMDB_DEBUG runtime == $runtime" }
   ## get country
   if [regexp {<h4 class="inline">Country:</h4>(.*?)</div>} $html dummy country] {
       set country [string map {&nbsp; " "} $country]
       regsub -all {<[^\>]*>} $country {} country
       set country [string map {"|" "||" } $country]
       regsub -all {[\n]+} $country {} country
       set country [string trim $country]
       while { [string first "  " $country] != -1 } {
         set country [string map {"  " " " } $country]
       }
   }
   if {$IMDB_DEBUG == 1} { putlog "IMDB_DEBUG country == $country" }
   ## get language
   if [regexp {<h4 class="inline">Language:</h4>(.*?)</div>} $html dummy language] {
       set language [string map {"See more" "" \n "" &nbsp; " " &raquo; ""} $language]
       regsub -all {<[^\>]*>} $language {} language
       regsub -all {[\n]+} $language {} language
       set language [string map {"|" "||"} $language]
set language [string trim $language]
       while { [string first "  " $language] != -1 } {
         set language [string map {"  " " " } $language]
       }
   }
   if {$IMDB_DEBUG == 1} { putlog "IMDB_DEBUG language == $language" }
   ## get movie color
   if [regexp {<h4 class="inline">Color:</h4>(.*?)</div>} $html dummy movie_color] {
       regsub -all {<[^\>]*>} $movie_color {} movie_color
       regsub -all {[\n]+} $movie_color {} movie_color
       while { [string first "  " $movie_color] != -1 } {
         set movie_color [string map {"  " " " } $movie_color]
       }
       set movie_color [string trim $movie_color]
       set movie_color [string map {"|" " |"} $movie_color]
   }
   if {$IMDB_DEBUG == 1} { putlog "IMDB_DEBUG movie_color == $movie_color" }
   ## get aspect ratio
   if [regexp {<h4 class="inline">Aspect Ratio:</h4>(.*?)</div>} $html dummy aspect_ratio] {
       regsub -all {<[^\>]*>} $aspect_ratio {} aspect_ratio
       set aspect_ratio [string map {"more" "" } $aspect_ratio]
       set aspect_ratio [string trim $aspect_ratio]
   }
   if {$IMDB_DEBUG == 1} { putlog "IMDB_DEBUG aspect_ratio == $aspect_ratio" }
   ## get soundmix
   if [regexp {<h4 class="inline">Sound Mix:</h4>(.*?)</div>} $html dummy soundmix] {
       set soundmix [string map {"See more" "" \n "" &nbsp; "" &raquo; ""} $soundmix]
       regsub -all {<[^\>]*>} $soundmix {} soundmix
       regsub -all {[\n]+} $soundmix {} soundmix
       set soundmix [string map {"|" "  ||"} $soundmix]
set soundmix [string trim $soundmix]
       while { [string first "  " $soundmix] != -1 } {
         set soundmix [string map {"  " " " } $soundmix]
       }
   }
   if {$IMDB_DEBUG == 1} { putlog "IMDB_DEBUG soundmix == $soundmix" }
   ## get certification
   if [regexp {<div class="infobar">.*?alt="(.*?)"} $html dummy cert] {
       regsub -all {<[^\>]*>} $cert {} cert
       set mpaa [string trim $cert]
       set mpaa [htmlcodes $cert]
   }
   if {$IMDB_DEBUG == 1} { putlog "IMDB_DEBUG cert == $cert" }
   ## get locations
   if { [regexp {<h4 class="inline">Filming Locations:</h4>(.*?)</div>} $html dummy film_locations] } {
       set film_locations [string map {"See more" ""  &raquo; ""} $film_locations]
       regsub -all {<[^\>]*>} $film_locations {} film_locations
       regsub -all {[\n\s]+} $film_locations { } film_locations
       set film_locations [string trim $film_locations]
       set film_locations [htmlcodes $film_locations]
   }
   if {$IMDB_DEBUG == 1} { putlog "IMDB_DEBUG film_locations == $film_locations" }
   ## get company
    if [regexp {<h3 class="subheading">Company Credits</h3>(.*?)</div>} $html dummy company] {
       set company [string map {"See more" "" &nbsp; "" &raquo; ""} $company]
set company [string map {"Production Co:"  ""} $company]
       regsub -all {<[^\>]*>} $company {} company
       regsub -all {[\n\s]+} $company { } company

       set company [string trim $company]
   }
   if {$IMDB_DEBUG == 1} { putlog "IMDB_DEBUG company == $company" }
 
   ## get cast
   if [regexp {<table class="cast_list">(.*?)</table>} $html dummy cast] {
       regsub -all {</tr>.*?<tr.*?>} $cast "\n" cast_multiline
       regsub -all {[\n]+} $cast_multiline {} cast_multiline
       regsub -all {<[^\>]*>} $cast_multiline {} cast_multiline
       set cast_multiline [string map {"rest of cast listed alphabetically:" \n} $cast_multiline]
       set cast_multiline [string trim [join [htmlcodes $cast_multiline]]]
       if { $cast_linelimit > 0 } {
          set nthoccur [expr [findnth $cast_multiline \n $cast_linelimit] - 1]
          if {$nthoccur > 0} {set cast_multiline [string range $cast_multiline 0 $nthoccur]}
       }
   }
   if {$IMDB_DEBUG == 1} { putlog "IMDB_DEBUG cast_multiline == $cast_multiline" }
   ## fill singleline
   regsub -all {\n} $cast_multiline " / " cast_line
   if {$IMDB_DEBUG == 1} { putlog "IMDB_DEBUG cast_line == $cast_line" }

   ## get budget
   if [regexp {<h4 class="inline">Budget:</h4> (.*?)</div>} $html dummy budget] {
      regsub -all {[\n]+} $budget {} budget
set budget [string range $budget 0 [expr [string first "<span" $budget] -1]]
set budget [string trim $budget]
   }
   if {$IMDB_DEBUG == 1} { putlog "IMDB_DEBUG budget == $budget" }
   ## get screens
   if [regexp {<h4 class="inline">Opening Weekend:</h4>\n(.*?Screens\))} $html dummy screens] {
      regsub -all {[\n]+} $screens { } screens
      regsub -all {<[^\>]*>} $screens {} screens
      set screens [htmlcodes $screens]
   }
   if {$IMDB_DEBUG == 1} { putlog "IMDB_DEBUG screens == $screens" }

   ## output results

   #cleaning the end url
   set cleanurl [string map {"www." ""} $newurl]
   set output [string map [list "%title" "$title" "%aka" "$aka" "%url" "$cleanurl" "%name" "$name" "%genre" "$genre" "%tagline" "$tagline" "%plot" "$plot" "%keywords" "$keywords" "%awards" "$awards" "%comment" "$comment" "%rating" "$rating" "%rbar" "$rating_bar" "%votes" "$votes" "%top250" "$top250" "%mpaa" "$mpaa" "%time" "$runtime" "%country" "$country" "%language" "$language" "%mcolor" "$movie_color" "%aspect" "$aspect_ratio" "%soundmix" "$soundmix" "%cert" "$cert" "%locations" "$film_locations" "%company" "$company" "%budget" "$budget" "%screens" "$screens" "%reldate" "$reldate"] $output]
   set checkvar ""
   regexp {.*?%castmline} $output checkvar
   if { [expr [regexp -all {%uline} $checkvar] % 2] == 1 } {
       set cast_multiline [string map {"\n" "\n%uline"} $cast_multiline]
   }
   if { [expr [regexp -all {%bold} $checkvar] % 2] == 1 } {
       set cast_multiline [string map {"\n" "\n%bold"} $cast_multiline]
   }
   if { [regexp {.*%color([\d]+(?:,[\d]+)?)[^\n]*?%castmline} $checkvar dummy colormline] } {
       regsub -all {\n} $cast_multiline "\n%color$colormline" cast_multiline
   }
   set output [replacevar $output "%castmline" $cast_multiline]
   set output [replacevar $output "%castline" $cast_line]
   set output [replacevar $output "%wcredits" $wcredits]
   regsub -all {\|[^\|]*?N/A[^\|]*?\|} $output "" output
   set output [string map {"||" "|" "|" ""} $output]
   regsub -all {\n[\n\s]*\n} $output "\n" output
   set output [string trim $output]
   set output [replacevar $output "%bold" "\002"]
   set output [replacevar $output "%uline" "\037"]
   set output [replacevar $output "%bull" "\u2022"]
   set output [replacevar $output "%color" "\003"]
   set output [encoding convertto utf-8 $output]
   foreach line [split [imdb_decode $output] "\n"] {
       while {$line != ""} {
           puthelp "$toput :[string range $line 0 399]"
           set line [string range $line 400 end]
       }
   }
   set imdb(lasttime,$chan) [clock seconds]
}

proc wmsg { } {
    global warn_msg
    set warn_msg 0
}

proc imdb_decode {text {char "utf-8"} } {
  # code below is neccessary to prevent numerous html markups
  # from appearing in the output (ie, &quot;, ?, etc)
  # stolen (borrowed is a better term) from tcllib's htmlparse ;)
  # works unpatched utf-8 or not, unlike htmlparse::mapEscapes
  # which will only work properly patched....
  set escapes {
     &nbsp; \xa0 &iexcl; \xa1 &cent; \xa2 &pound; \xa3 &curren; \xa4
     &yen; \xa5 &brvbar; \xa6 &sect; \xa7 &uml; \xa8 &copy; \xa9
     &ordf; \xaa &laquo; \xab &not; \xac &shy; \xad &reg; \xae
     &macr; \xaf &deg; \xb0 &plusmn; \xb1 &sup2; \xb2 &sup3; \xb3
     &acute; \xb4 &micro; \xb5 &para; \xb6 &middot; \xb7 &cedil; \xb8
     &sup1; \xb9 &ordm; \xba &raquo; \xbb &frac14; \xbc &frac12; \xbd
     &frac34; \xbe &iquest; \xbf &Agrave; \xc0 &Aacute; \xc1 &Acirc; \xc2
     &Atilde; \xc3 &Auml; \xc4 &Aring; \xc5 &AElig; \xc6 &Ccedil; \xc7
     &Egrave; \xc8 &Eacute; \xc9 &Ecirc; \xca &Euml; \xcb &Igrave; \xcc
     &Iacute; \xcd &Icirc; \xce &Iuml; \xcf &ETH; \xd0 &Ntilde; \xd1
     &Ograve; \xd2 &Oacute; \xd3 &Ocirc; \xd4 &Otilde; \xd5 &Ouml; \xd6
     &times; \xd7 &Oslash; \xd8 &Ugrave; \xd9 &Uacute; \xda &Ucirc; \xdb
     &Uuml; \xdc &Yacute; \xdd &THORN; \xde &szlig; \xdf &agrave; \xe0
     &aacute; \xe1 &acirc; \xe2 &atilde; \xe3 &auml; \xe4 &aring; \xe5
     &aelig; \xe6 &ccedil; \xe7 &egrave; \xe8 &eacute; \xe9 &ecirc; \xea
     &euml; \xeb &igrave; \xec &iacute; \xed &icirc; \xee &iuml; \xef
     &eth; \xf0 &ntilde; \xf1 &ograve; \xf2 &oacute; \xf3 &ocirc; \xf4
     &otilde; \xf5 &ouml; \xf6 &divide; \xf7 &oslash; \xf8 &ugrave; \xf9
     &uacute; \xfa &ucirc; \xfb &uuml; \xfc &yacute; \xfd &thorn; \xfe
     &yuml; \xff &fnof; \u192 &Alpha; \u391 &Beta; \u392 &Gamma; \u393 &Delta; \u394
     &Epsilon; \u395 &Zeta; \u396 &Eta; \u397 &Theta; \u398 &Iota; \u399
     &Kappa; \u39A &Lambda; \u39B &Mu; \u39C &Nu; \u39D &Xi; \u39E
     &Omicron; \u39F &Pi; \u3A0 &Rho; \u3A1 &Sigma; \u3A3 &Tau; \u3A4
     &Upsilon; \u3A5 &Phi; \u3A6 &Chi; \u3A7 &Psi; \u3A8 &Omega; \u3A9
     &alpha; \u3B1 &beta; \u3B2 &gamma; \u3B3 &delta; \u3B4 &epsilon; \u3B5
     &zeta; \u3B6 &eta; \u3B7 &theta; \u3B8 &iota; \u3B9 &kappa; \u3BA
     &lambda; \u3BB &mu; \u3BC &nu; \u3BD &xi; \u3BE &omicron; \u3BF
     &pi; \u3C0 &rho; \u3C1 &sigmaf; \u3C2 &sigma; \u3C3 &tau; \u3C4
     &upsilon; \u3C5 &phi; \u3C6 &chi; \u3C7 &psi; \u3C8 &omega; \u3C9
     &thetasym; \u3D1 &upsih; \u3D2 &piv; \u3D6 &bull; \u2022
     &hellip; \u2026 &prime; \u2032 &Prime; \u2033 &oline; \u203E
     &frasl; \u2044 &weierp; \u2118 &image; \u2111 &real; \u211C
     &trade; \u2122 &alefsym; \u2135 &larr; \u2190 &uarr; \u2191
     &rarr; \u2192 &darr; \u2193 &harr; \u2194 &crarr; \u21B5
     &lArr; \u21D0 &uArr; \u21D1 &rArr; \u21D2 &dArr; \u21D3 &hArr; \u21D4
     &forall; \u2200 &part; \u2202 &exist; \u2203 &empty; \u2205
     &nabla; \u2207 &isin; \u2208 &notin; \u2209 &ni; \u220B &prod; \u220F
     &sum; \u2211 &minus; \u2212 &lowast; \u2217 &radic; \u221A
     &prop; \u221D &infin; \u221E &ang; \u2220 &and; \u2227 &or; \u2228
     &cap; \u2229 &cup; \u222A &int; \u222B &there4; \u2234 &sim; \u223C
     &cong; \u2245 &asymp; \u2248 &ne; \u2260 &equiv; \u2261 &le; \u2264
     &ge; \u2265 &sub; \u2282 &sup; \u2283 &nsub; \u2284 &sube; \u2286
     &supe; \u2287 &oplus; \u2295 &otimes; \u2297 &perp; \u22A5
     &sdot; \u22C5 &lceil; \u2308 &rceil; \u2309 &lfloor; \u230A
     &rfloor; \u230B &lang; \u2329 &rang; \u232A &loz; \u25CA
     &spades; \u2660 &clubs; \u2663 &hearts; \u2665 &diams; \u2666
     &quot; \x22 &amp; \x26 &lt; \x3C &gt; \x3E O&Elig; \u152 &oelig; \u153
     &Scaron; \u160 &scaron; \u161 &Yuml; \u178 &circ; \u2C6
     &tilde; \u2DC &ensp; \u2002 &emsp; \u2003 &thinsp; \u2009
     &zwnj; \u200C &zwj; \u200D &lrm; \u200E &rlm; \u200F &ndash; \u2013
     &mdash; \u2014 &lsquo; \u2018 &rsquo; \u2019 &sbquo; \u201A
     &ldquo; \u201C &rdquo; \u201D &bdquo; \u201E &dagger; \u2020
     &Dagger; \u2021 &permil; \u2030 &lsaquo; \u2039 &rsaquo; \u203A
     &euro; \u20AC &apos; \u0027 &lrm; "" &rlm; ""
  };
  if {![string equal $char [encoding system]]} { set text [encoding convertfrom $char $text] }
  set text [string map [list "\]" "\\\]" "\[" "\\\[" "\$" "\\\$" "\"" "\\\"" "\\" "\\\\"] [string map -nocase $escapes $text]]
  regsub -all -- {&#([[:digit:]]{1,5});} $text {[format %c [string trimleft "\1" "0"]]} text
  regsub -all -- {&#x([[:xdigit:]]{1,4});} $text {[format %c [scan "\1" %x]]} text
  catch { set text "[subst "$text"]" }
  if {![string equal $char [encoding system]]} { set text [encoding convertto $char $text] }
  return "$text"
}

putlog "IMDB Info Version 03.12.2016: LOADED"
#5
Bonjour,

Il me semble qu'il faut que le package TCL-TLS soit installé sur le système.

Essaye "apt-get install tcltls" si tu es sur debian/ubuntu ou "yum install tcltls" si tu es sur CentOS (il faut être root bien entendu).
#6
Bonjour DaDiss,

Je l'ai deja installe, est ce que le script fonctionne pour toi ?
#7
Ca marche bien chez moi.

Tu as bien chargé le script http.tcl sur ton eggdrop ?

tu le trouvera ici => https://scripts.eggdrop.fr/details-http.tcl-s11.html

Il faut le charger comme n'importe quel autre tcl sur le fichier de configuration de ton eggdrop (avant imdb.tcl).
#8
Pour moi il y a un petit bug dans le script:

tcl
set IMDB_ALTERNATIVE 1
# ...
if { $IMDB_ALTERNATIVE == 0 } { package require http 2.3 }
set packages(tls) [catch {package require tls}]; # https
::http::register https 443 ::tls::socket

Donc, le package http n'est chargé que si IMDB_ALTERNATIVE est à 0, mais dans tous les cas on l'utilise pour faire ::http::register. Il y a une incohérence.

Essaye donc en changeant la première ligne que je cite pour mettre set IMDB_ALTERNATIVE 0
Zeolia - Offrez-moi un café
Merci de ne pas demander d'aide en MP
Away
#9
Merci a vous pour votre aide, je fais les essais ce soir et vous tiens informe.
#10
(05/06/2020, 00:11)CrazyCat Wrote: Pour moi il y a un petit bug dans le script:

tcl
set IMDB_ALTERNATIVE 1
# ...
if { $IMDB_ALTERNATIVE == 0 } { package require http 2.3 }
set packages(tls) [catch {package require tls}]; # https
::http::register https 443 ::tls::socket

Donc, le package http n'est chargé que si IMDB_ALTERNATIVE  est à 0, mais dans tous les cas on l'utilise pour faire ::http::register. Il y a une incohérence.

Essaye donc en changeant la première ligne que je cite pour mettre set IMDB_ALTERNATIVE 0

Oui c'est logique, c'est pour ça que sur mon eggdrop qui charge déjà le script http séparément ça a bien fonctionné :)
#11
(05/06/2020, 13:06)Kossiwa Wrote: Merci a vous pour votre aide, je fais les essais ce soir et vous tiens informe.

Bonsoir a vous deux, désole de la reponse tardive.

DaDIsS

J'ai suivi tes instructions et le script marche a merveille !
Merci a toi.
Je ne savais pas que le fichier HTML était nécessaire


CrazyCat

J'ai laisse la variable IMDB_ALTERNATIVE a 1 et cela fonctionne quand même, j’essayerai a l’occasion de le mettre a 0
Je vais en profiter de tester ton script chanrelay dans les jours a venir , il m''nteresse vraiment. et dervait m'etre utile
Je te tiens au courant.

Bon week end a vous
#12
(06/06/2020, 20:14)Kossiwa Wrote: J'ai suivi tes instructions et le script marche a merveille !
Merci a toi.
Je ne savais pas que le fichier HTML était nécessaire
Le http.tcl (et pas html) n'est certainement pas nécessaire vu que ce package existe dans tcllib depuis un bon nombre d'années. C'est juste le script qui est à revoir, avec un petit changement d'accolade:

tcl
if { $IMDB_ALTERNATIVE == 0 } {
   package require http
   set packages(tls) [catch {package require tls}];
   ::http::register https 443 ::tls::socket
}

C'est bête, mais en déplaçant une accolade fermante, on obtient le bon fonctionnement: appeler la procédure d'un package qu'après l'avoir chargé.
Zeolia - Offrez-moi un café
Merci de ne pas demander d'aide en MP
Away
#13
En effet, je viens de l'apprendre grâce à toi CrazyCat, merci :)

J'ai toujours chargé ce tcl avant tous les autres sans jamais me poser de question puisque cela avait plutôt bien marché jusqu'ici

Il s'avère qu'en l'enlevant tous mes scripts continuent de marcher, à part le imdb bien sûr lol

Kossiwa, si tu veux vraiment faire les choses bien, enleve le http.tcl et corrige le imdb.tcl tel qu'indiqué par CrazyCat


Possibly Related Threads…
Thread Author Replies Views Last Post
  Erreur socket limit Amand 4 230 18/06/2022, 15:37
Last Post: Amand
  [Bug] script bot socket athor69 0 3,103 31/01/2016, 17:51
Last Post: athor69
  Codage TCL - Socket incorporé KeeViiNou 15 10,097 21/03/2014, 11:46
Last Post: KeeViiNou
  Soucis de script HTTP.TCL loulou7593 10 6,596 25/02/2013, 23:58
Last Post: loulou7593
  Socket TCL tow 1 4,383 24/11/2012, 08:34
Last Post: Artix
  Bug bizarre : Namespace, array et socket CrazyCat 3 4,447 23/02/2012, 18:12
Last Post: djkenny
  Socket Obu 4 5,110 27/02/2011, 03:37
Last Post: Obu
  nick non register msg cestlemien 11 6,969 20/12/2010, 23:20
Last Post: alanfollow
  Plusieurs connections simultanémment sur une socket. jolo2 1 4,119 23/04/2010, 23:54
Last Post: Marc
  aide avec http.tcl jabaka 11 9,553 23/09/2008, 16:34
Last Post: tony62

Forum Jump:


Users browsing this thread: 1 Guest(s)