Parameters for Execute Plugin?
Parameters for Execute Plugin?
Hi,
Is there any way to add parameters to the execute plugin?
Like, run C:\some_command.exe $torrent_directory or something like that?
Is there any way to add parameters to the execute plugin?
Like, run C:\some_command.exe $torrent_directory or something like that?
Re: Parameters for Execute Plugin?
I was planning to add this but never got around to it I'm afraid.
The parameters are static and are as follows:
So the parameter you wish is the third one passed to the command, but in future they may become configurable.
The parameters are static and are as follows:
Code: Select all
./some_command $TORRENT_ID $TORRENT_NAME $TORRENT_PATH
Re: Parameters for Execute Plugin?
Hi!
Apparently this $TORRENT_PATH returns the downloading location of the torrent. Shouldn't it return the path that the torrent is moved to after completion, if you have that option enabled?
Thanks.
Apparently this $TORRENT_PATH returns the downloading location of the torrent. Shouldn't it return the path that the torrent is moved to after completion, if you have that option enabled?
Thanks.
Re: Parameters for Execute Plugin?
Nevermind.
In core.py, in the Execute.egg
Find:
Replace with:
Now, under:
Add:
Finally, replace:
With:
Parameters will be:
In core.py, in the Execute.egg
Find:
Code: Select all
info = torrent.get_status(["name", "save_path""])
Code: Select all
info = torrent.get_status(["name", "save_path", "move_on_completed_path"])
Code: Select all
path = info["save_path"]
Code: Select all
finalpath = info["move_on_completed_path"]
Code: Select all
p = Popen([command, torrent_id, torrent_name, path],
Code: Select all
p = Popen([command, torrent_id, torrent_name, path, finalpath],
Code: Select all
./some_command $TORRENT_ID $TORRENT_NAME $TORRENT_PATH $TORRENT_MOVED_PATH
Re: Parameters for Execute Plugin?
Znuff wrote:Nevermind.
In core.py, in the Execute.egg
Find:Replace with:Code: Select all
info = torrent.get_status(["name", "save_path""])
Now, under:Code: Select all
info = torrent.get_status(["name", "save_path", "move_on_completed_path"])
Add:Code: Select all
path = info["save_path"]
Finally, replace:Code: Select all
finalpath = info["move_on_completed_path"]
With:Code: Select all
p = Popen([command, torrent_id, torrent_name, path],
Parameters will be:Code: Select all
p = Popen([command, torrent_id, torrent_name, path, finalpath],
Code: Select all
./some_command $TORRENT_ID $TORRENT_NAME $TORRENT_PATH $TORRENT_MOVED_PATH
Well spotted, I wasn't using move_completed at the time of writing, however I don't think the way you have fixed it is correct. I prefer:
Code: Select all
path = info["save_path"] if info["move_on_completed_path"] == info["save_path"] else info["move_on_completed_path"]
Code: Select all
./some_command $TORRENT_ID $TORRENT_NAME $TORRENT_PATH

I've fixed this in svn (both trunk and 1.2) as of r5991
Re: Parameters for Execute Plugin?
Indeed, your fix is way better. My python-fu is weak.
Edit: actually I propose to CHECK if move_completed is TRUE first, else the users will get the move_path even if it's not enabled, but it's just completed.
edit2: there's something wrong. I have the default torrent path set to /torrents/downloading, I added a torrent, I change it's path to /torrents/MP3, but the Execute plugin reported my home directory?!
edit3: here we go, feel free to optimise:
Edit: actually I propose to CHECK if move_completed is TRUE first, else the users will get the move_path even if it's not enabled, but it's just completed.
edit2: there's something wrong. I have the default torrent path set to /torrents/downloading, I added a torrent, I change it's path to /torrents/MP3, but the Execute plugin reported my home directory?!
edit3: here we go, feel free to optimise:
Code: Select all
if torrent.get_status(["move_completed"]):
path = info["move_on_completed_path"]
else:
path = info["save_path"]
Re: Parameters for Execute Plugin?
How do i edit the source files for this? I also need to send the downloaded directory to a job but the only parameter that is being passed is the download location the torrent was picked up from. Not entirely useful 
