Page 1 of 1

Move to different folder? (execute script)

Posted: Thu Jan 12, 2012 11:25 pm
by shinkasa4
Hi,
Running latest deluge on Windows!

I want to use execute plugin to do the following:
On completion of a torrent, WAIT 180 seconds, then move to "C:\" directory. So move to C:\ after waiting 180 seconds upon torrent completion

The wait 180 seconds part is very important, but will be complicated and long-winded to explain here :)

Can you please help me write this script?

Re: Move to different folder? (execute script)

Posted: Fri Jan 13, 2012 12:12 am
by CSB
Unless you want the same file to be downloaded over and over, or you don't want to seed, this cannot be done.

The daemon blocks on execute plugin scripts, so any execute script attempting to interact with the daemon as a client will stall the daemon, thus the above caveats. This also means that every time a torrent finishes, the daemon would block for 180 seconds.

Alternatively, the execute script could execute a client script as a background task, which would do all of the work.

Re: Move to different folder? (execute script)

Posted: Sun Mar 11, 2012 4:16 pm
by chimpy
I don't know about Windows, but the equivalent on Linux would be something like:

Code: Select all

       
torrentid=$1
torrentname=$2
torrentpath=$3
sleep 180
mv "$torrentpath/$torrentname" /
This is using the Execute plugin upon torrent completion, obviously.

Re: Move to different folder? (execute script)

Posted: Tue Mar 13, 2012 2:24 am
by Lazybones
I believe the blocking behavior of scripts will be changed in 1.3.4, but if you don't want deluge to hang duing your sleep statement you need to lauch your script from all calling script.

In linux you would put an & at the end of the line.

In windows put your actual code in a second script file and then call it like this

call otherCommand.bat

this should cause it to run separately.

Re: Move to different folder? (execute script)

Posted: Tue Mar 13, 2012 5:39 am
by johnnyg
1.3.4 has been released and yes it doesn't wait on scripts to finish anymore (so it won't hang).

As a side note you shouldn't use mv as deluge will no longer be able to seed that torrent.
I believe you want to either use deluge's "move completed to" feature or just copy the file to another location.