[Libtorrent-devel] Need help creating a event.download.finished script (0.8.6)

Grant Emsley grant at emsley.ca
Wed Oct 20 20:24:08 UTC 2010

I learnt that running it directly from rtorrent can sometimes cause problems.

My solution for transfering files (I actually wrote a custom rutorrent
plugin to manage it all) is to set a custom flag on the file with a 1
if it is to be transferred.

I have a php script that runs every 5 minutes which uses xmlrpc to
check for torrents that have that flag set, and are completed, and
transfer them.  After the transfer successfully completes, it changes
the flag to a 0.  This allows transfers to be retried if they fails.

In rutorrent, I have a plugin that adds some columns and right click
commands to show and set the transfer status, including setting
multiple locations to transfer it to.  I even modified the rutorrent
RSS plugin to let you select certain rss filters to mark for transfer.
 It works great.

I can post the code if anyone wants it...could probably use some
cleaning up, but I'm sure someone can at least use it as a base to
start on.


On Wed, Oct 20, 2010 at 9:08 AM, Perl Whore <whoreperl at gmail.com> wrote:
> This should do it.
> schedule =
> watch_directory1,5,1,"load_start=/home/rt/torrents/watch/*.torrent,\"d.set_custom=ftp,1\""
> system.method.set_key =
> event.download.finished,transferAfterComplete,"branch=d.get_custom=ftp,\"execute=~/transfer2me.sh,$d.get_base_path=\""
> The script will execute only if the torrent was loaded from that watch
> directory.
> On Wed, Oct 20, 2010 at 5:43 PM, pred <predecessor at gmail.com> wrote:
>> Ok, i think i have it!
>> schedule =
>> watch_directory,5,1,"load_start=/home/rt/torrents/watch/*.torrent,
>> view.set_visible=my_rss, d.set_custom1=watch-torrent"
>> view.set_visible=my_rss     is actually insignificant. i can set a
>> different max ratio for my rss download torrents.
>> d.set_custom1=watch-torrent    this is now i label my rss download
>> torrents. This wil also appear as the Label at rutorrent. Nice!
>> and my event.download.finished:
>> system.method.set_key =
>> event.download.finished,transferAfterComplete,"execute=~/transfer2me.sh,$d.get_name=,$d.get_custom1="
>> Pretty simple, eh!? Well i didn't unterstand that strange if-conditon
>> syntax. So why not just do the seperation in the script file.
>> So Parameter for the Scriptfile are the FolderName of the Download
>> (destination dir is always the same) and the Label-Name.
>> I can mark manually to rutorrent added torrents with the Label
>> 'watch-torrent' and when they are finished, they will be automatically
>> transfered to my second machine.
>> Ok, that's the first part of all the stuff. I will work on my
>> transfer2me.sh
>> 2010/10/20 Balaji Dutt <balaji.dutt at gmail.com>
>>> On Wed, Oct 20, 2010 at 4:08 PM, pred <predecessor at gmail.com> wrote:
>>>> i would add:
>>>>    system.method.set_key =
>>>> event.download.finished,transfer2,"execute=~/rtorrent_transferAfterComplete.sh,$d.get_name="
>>>> Is $d.get_name= the file or directory of the finished torrent? So that i
>>>> could use it with $1 to transfer the file?
>>> $d.get_name returns the name of the torrent only. To get the directory of
>>> the finished torrent you would need to use $d.get_base_path=
>>>> And another important point: I only want to transfer the finished
>>>> torrent that has been added from the watch_dir.
>>>> Other torrent, eg. added via webGUI rutorrent should not be transfered.
>>> You will need to experiment with a combination of set_custom & a if
>>> condition is my guess. Something along the lines of the following:
>>> schedule =
>>> watch_directory,5,1,load_start=/home/rt/torrents/watch/*.torrent,
>>> d.set_custom1=watch-torrent
>>> system.method.set_key =
>>> event.download.finished,ftp_complete,"if=$d.get_custom1=,\\execute=~/rtorrent_transferAfterComplete.sh,$.get_base_path=,\\$d.set_custom2=$d.get_custom1="
>>> --
>>> Balaji
>>> _______________________________________________
>>> Libtorrent-devel mailing list
>>> Libtorrent-devel at rakshasa.no
>>> http://rakshasa.no/mailman/listinfo/libtorrent-devel
>> _______________________________________________
>> Libtorrent-devel mailing list
>> Libtorrent-devel at rakshasa.no
>> http://rakshasa.no/mailman/listinfo/libtorrent-devel
> _______________________________________________
> Libtorrent-devel mailing list
> Libtorrent-devel at rakshasa.no
> http://rakshasa.no/mailman/listinfo/libtorrent-devel

More information about the Libtorrent-devel mailing list