View Full Version : execute a command after a sfv arrives
r3flux
05-28-2005, 06:57 PM
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
esmandil
05-29-2005, 08:05 AM
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.
r3flux
05-29-2005, 10:01 AM
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.
Mouton has created something similar a while ago.
http://www.ioftpd.com/board/showthread.php?s=&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).
r3flux
05-29-2005, 01:23 PM
Originally posted by Harm
Mouton has created something similar a while ago.
http://www.ioftpd.com/board/showthread.php?s=&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.
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
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:
// [...]
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 :)
vBulletin® v3.8.11 Alpha 3, Copyright ©2000-2024, vBulletin Solutions, Inc.