Old 05-28-2005, 06:57 PM   #1
r3flux
Member
ioFTPD Foundation User
 
Join Date: Feb 2005
Posts: 48
Default execute a command after a sfv arrives

heya forum

i got a lil task to do. i want perform a command when there is a sfv uploaded to the site. (alternative action: when a new dir is created). this command need as arg the name of the new folder.

and the best place for that is in that proc that reads the ioFTPD.log in dZSbot. but i dont know where i should add this, im not that familiar with tcl at all.

would be great if someone could help me out on that issue tho.

cheers,
r3flux
r3flux is offline   Reply With Quote
Old 05-29-2005, 08:05 AM   #2
esmandil
Senior Member
FlashFXP Registered User
ioFTPD Foundation User
 
Join Date: Oct 2004
Posts: 107
Default

Just an idea... but I think it would be easier to use onUploadComplete in ioftpd.ini -- you just need a script to check if uploaded file is *.sfv and execute your command if it is.
esmandil is offline   Reply With Quote
Old 05-29-2005, 10:01 AM   #3
r3flux
Member
ioFTPD Foundation User
 
Join Date: Feb 2005
Posts: 48
Default

Quote:
Originally posted by esmandil
Just an idea... but I think it would be easier to use onUploadComplete in ioftpd.ini -- you just need a script to check if uploaded file is *.sfv and execute your command if it is.
Yeah, but when i make it that way, can i still perform a command in the sitechan? Thats the part i missed to mention in my first post

to be more detailed:

i want to implement a litle pretime announce for dZsbot. i've already created a mysql db wich stores all the pretimes and a script that checked a release name against the db is also ready. but now i need a trigger that calles the tcl function that opens a socket to a php script (thats already done also). i need ony call the function with the new dir name as an argument.
r3flux is offline   Reply With Quote
Old 05-29-2005, 11:19 AM   #4
Harm
Too much time...
Ultimate Scripter
 
Join Date: Jul 2003
Posts: 1,430
Default

Mouton has created something similar a while ago.
http://www.ioftpd.com/board/showthre...=&threadid=740
I know it adds the dirnames to the database instead of reading from it but it might help.

You could also edit the readlog proc (I think that's how it's called in dZSbot) to call your script when [string equal "NEWDIR" $msgtype] or when [string equal "SFV" $msgtype] (if you want it on sfv upload).
Harm is offline   Reply With Quote
Old 05-29-2005, 01:23 PM   #5
r3flux
Member
ioFTPD Foundation User
 
Join Date: Feb 2005
Posts: 48
Default

Quote:
Originally posted by Harm
Mouton has created something similar a while ago.
http://www.ioftpd.com/board/showthre...=&threadid=740
I know it adds the dirnames to the database instead of reading from it but it might help.
Not really I already read this post before i post my question here.

Quote:
Originally posted by Harm
You could also edit the readlog proc (I think that's how it's called in dZSbot) to call your script when [string equal "NEWDIR" $msgtype] or when [string equal "SFV" $msgtype] (if you want it on sfv upload).
Yeah, this seems to be what im looking for.

Here is what i have now in dZSbot.tcl

Code:
proc readlog {} {

    seek $of $lastoct
    while {![eof $of]} {
        
	// [...]

        if { $msgtype == "NEWDIR" } {
	    set path [lindex $line 5]
	    performDupe pretime $path $user $host $chan
	}
    }

    close $of
    set lastoct [file size $location(IOLOG)/ioFTPD.log]
    launchnuke
    utimer 1 "readlog"
    return 0
}
But when i now make a new dir on the site, this happens in the sitechan:

[SECTION] + [PRETIME] :: test.folder :: was pre'd 12m 43s ago.
[SECTION] + [NEW RELEASE] :: 0529/test.folder by xxx/xxxx

but it should be the other way, first new folder and then pretime.

would be nice if anyone could help me further with that one, im not very familiar with tcl at all

thx

** update **
problem solved. i found a solution:

got the solution:

Code:
// [...]
if { [info exists variables($msgtype)] } {
    set echoline [parse $msgtype $var1 $section]
    sndall $section $echoline
} else {
    set echoline [parse DEFAULT $var1 $section]
    sndall $section $echoline
}

if { $msgtype == "NEWDIR" } {
    set path [lindex $line 5]
    performDupe pretime $path $user $host $chan
}
all works fine
r3flux is offline   Reply With Quote
Reply

Tags
command, dzsbot, familiar, sfv, tcl

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 01:44 AM.

Parts of this site powered by vBulletin Mods & Addons from DragonByte Technologies Ltd. (Details)