This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Tcl Error

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
s
smolder
Voice
Posts: 11
Joined: Mon Jul 06, 2015 7:42 pm

Tcl Error

Post by smolder »

[Edit] (Just realized i have posted my topic on wrong forum, it should be on "Tcl FAQ" i think, i am sorry.)

Hello to all Tcl Gurus,
I got the Tcl script from this post http://forum.egghelp.org/viewtopic.php?t=19009
While trying to run the script i get this error message...

"Tcl error [curl:image]: couldn't open "/home/amo/public_html/images/dupe.db"

what is "dupes.db" and how to fix this error?

As mentioned in script Curl is required, i have already installed the Curl on my shell, do i need to configure it as well ? I am zero in Curl.
Hope you guys will help me out.
many thanks.

Code: Select all

# 16/06/2012 
# by doggo #omgwtfnzbs @ EFNET 
# curl_image.tcl 
# 
# curl is required on the shell to use this script 
# available @ http://curl.haxx.se/ 
######################################################### 


bind pubm -|- {*://*.jpg*} curl:image 
bind pubm -|- {*://*.jpe*} curl:image 
bind pubm -|- {*://*.jpeg*} curl:image 
bind pubm -|- {*://*.gif*} curl:image 
bind pubm -|- {*://*.png*} curl:image 
bind pubm -|- {*://*.bmp*} curl:image 


set save_folder "/home/amo/public_html/images"
set dupe_links  "/home/amo/public_html/images/dupe.db"
set your_site "http://your.website.url" 

proc curl:image {nick userhost handle channel str} { 
global save_folder dupe_links your_site 

set urlcheck(ext) { 
       jpg 
       jpe 
       jpeg 
       gif 
       png 
       bmp 
} 

if {![regexp {((?:http://|www\.)+[^ ]+)} $str str]} { return } 
set extension "" 
       set wlink $str 
       if { [string match -nocase "*$your_site*" "$wlink"] == 1 } { return } 
       regsub -all -- {(http://)+} $str "" str 
       regexp {(www.)?[A-z|0-9|\-|\.|\_]*\.[A-z]{2,3}} $str host 
       regexp {[/]+(.)*} $str url 
       regexp {[A-z]{3,4}$} $str extension 
       set ispic 0 
       foreach i $urlcheck(ext) { 
               if {[string match -nocase $extension $i]} { 
                       set ispic 1 
               } 
       } 

       if {$ispic != 1} { return } 

       set file_name [md5 $wlink] 

       set file [open $dupe_links r] 
       set data [read $file] 
       close $file 
       set isdupe 0 
       foreach line [split $data \n] { 
           if { [string match -nocase "*$file_name*" "$line"] == 1 } { 
               catch {unset data} 
             set isdupe 1 
           } 
       } 

       if {$isdupe == 1} { return } 

       catch {exec curl $wlink -o $save_folder/$file_name.$extension} 

       if {![file exists $save_folder/$file_name.$extension]} { 
       return 
       } else { 
       set fp [open $dupe_links "a"] 
       puts $fp $file_name.$extension 
       close $fp 
  
    } 
} 

putlog "curl_image.tcl loaded" 
User avatar
Arnold_X-P
Master
Posts: 226
Joined: Mon Oct 30, 2006 12:19 am
Location: DALnet - Trinidad - Beni - Bolivia
Contact:

Re: Tcl Error

Post by Arnold_X-P »

the error is:
set save_folder "/home/amo/public_html/images"
set dupe_links "/home/amo/public_html/images/dupe.db"

change amo for user access example
set dupe_links "/home/my logging/public_html/images/dupe.db"
.:an ideal world:. www.geocities.ws/chateo/yo.htm
my programming place /server ix.scay.net:7005
s
smolder
Voice
Posts: 11
Joined: Mon Jul 06, 2015 7:42 pm

Re: Tcl Error

Post by smolder »

Arnold_x-p: thank you for your reply.
"amo" is my username on shell account. The issue is... there's no such file named "dupe.db" in any directory, it's kind of database file But i have no idea how to create/generate this file. :?
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

in shell

Code: Select all

touch /home/amo/public_html/images/dupe.db
Once the game is over, the king and the pawn go back in the same box.
s
smolder
Voice
Posts: 11
Joined: Mon Jul 06, 2015 7:42 pm

Post by smolder »

caesar wrote:in shell

Code: Select all

touch /home/amo/public_html/images/dupe.db
Thank you for you help Caesar. Dupe.db has been created but still this script is not working for me. :(
I think i should find alternative.
Thank you once again for all you help guys.
Regards.
Post Reply