[Libtorrent-devel] Can i invoke more than 1 command (such as move, unrar etc.) after torrent finishes download

Josef Drexler josef at ttdpatch.net
Wed Nov 7 18:30:18 UTC 2007


On Nov 7, 2007, at 6:22 PM, Örjan Nordlund wrote:
> Hi !
>
> This is probably a newbie question but....
>
> I have a script that unpacks all .rar files in a dirtree to my  
> "real" directory depending on type of download. This is currently  
> running as cronjob but i would really like to invoke it after the  
> torrent has been moved...
>
> as the example .rtorrent.rc:
>
> 	# On completion, move the torrent to the directory from custom1.
> 	on_finished = move_complete,"execute=mv,-u,$d.get_base_path=, 
> $d.get_custom1= ;d.set_directory=$d.get_custom1="

This already runs two commands:
1. execute=mv,-u,$d.get_base_path=,$d.get_custom1=
2. d.set_directory=$d.get_custom1=

Adding a third will work just as well.

> i would like to add a line something like
>
> 	on_finished = unpack_complete,"execute=~/scripts/unpackrar.py  
> <from dir> <to dir>

That should be fine too, although then the order of execution with  
respect to other on_finished entries is not guaranteed[*], i.e. this  
command might be run before or after the move_complete commands. But  
as long as you use $d.get_base_path= here instead of a hardcoded  
path, it might not matter.

[*] Currently they will be processed in alphabetical order of the  
tags, but I don't know if that might change in the future.

> This requires that i can keep two directories in custom vars and  
> that i can access these in the command line. Furthermore i need to  
> know that the previous command has finished (the move in my case)

Not a problem. You have five custom vars.

-- 
Josef Drexler
josef at ttdpatch.net





More information about the Libtorrent-devel mailing list