[Libtorrent-devel] rtorrent on_finished and commands

Josef Drexler josef at ttdpatch.net
Thu Nov 15 19:53:54 UTC 2007


On Nov 15, 2007, at 3:34 PM, Georg Müller wrote:
> for some bandwidth/network testing I want to redownload finished  
> torrents.
>
> I have seen the "on_finished" trigger and the "load_start" command,  
> but I am not
> sure how to combine them to achieve the redownloading. I haven't  
> found a good
> documentation on which variables are accessible for a torrent.

load_start won't do anything if the download already exists in rtorrent.

If it needs to be fully automatic, I'd suggest setting up a watch  
directory that adds torrents moved into there and removes them when  
the file is moved out.

schedule = watch_directory,10,10,load_start=~/Download/watch/*.torrent
schedule = untied_directory,10,10,remove_untied=

Then, in on_finished you move the tied file out of the watch  
directory to have rtorrent also remove the corresponding download.

on_finished = move_complete,"execute=mv,$d.get_tied_to_file=,~/ 
Download/redo"

Then you have a cron job or something that deletes the downloaded  
data (though you could also do that in on_finished), and moves the  
torrent file back into the watch directory. It might also work to do  
this in an on_erase= handler in some way to make it happen when  
rtorrent actually removes the download.

The important part is that the download is removed from rtorrent, to  
clear the completion status, and to delete the downloaded data so  
that rtorrent doesn't just find it all intact and actually needs to  
re-download when the torrent is added again.

It may also work to do the following in on_finished: close the  
torrent, delete all data, and then start the download. You probably  
have to start it twice since it will find that its internal  
completion status does not match the files.

Note that I haven't tested any of this, but I hope it helps you  
figure out how it can work.

-- 
Josef Drexler
josef at ttdpatch.net





More information about the Libtorrent-devel mailing list