Automatically rotate torrents (delete oldest ones based upon the space needed by new ones)

779 views
Skip to first unread message

Krisztian Kovacs

unread,
Apr 23, 2015, 11:56:19 AM4/23/15
to pyrosco...@googlegroups.com
Hi!

I need your help to figure it out how to achieve this (this is the last big missing bit in my setup).
There's a script which downloads into a watch folder the meta (torrent) files. When the disk is getting full I want to delete the oldest ones based upon the space what the new ones need.
I set in rtorrent config, that when a meta (torrent) file is deleted, the corresponding data is deleted as well.

What I used so far was a cron job which run every 10 mins, checks the free space, deletes ONLY 1, the last metafile (torrent) if disk space reached a treshold.
It's not good in many ways, but a it was working so-so most of the time (whit slow download speed, and "small" data). But sometimes a 250GB (!) torrent has been downloaded (and not just 1 at the same time), and that is not working at all :)

So, what I need is some kind of scripting (maybe the help of rcontrol), or if it can be done inside rtorrent config it would be better (unfortunately I can't specify a method for low_diskspace event)

Thanks for helping!

Pat Padgett

unread,
Apr 23, 2015, 12:04:40 PM4/23/15
to pyrosco...@googlegroups.com
I use a script that runs rtcontrol with --cull.  I run it interactively, but you can use the --cron option too.

    rtcontrol tracker=*private_tracker_1* is_complete=y seedtime=+1w --cull
    rtcontrol tracker=*private_tracker_2* is_complete=y ratio=+1.01 --cull
    rtcontrol tracker=*private_tracker_3* is_complete=y seedtime=+5d --cull

    # clean up unregistered torrents
    rtcontrol message=*unregister* --cull

Some private trackers have different rules on seed time, ratio, etc.  I have these setup to follow the rules, and then delete.  I keep copies of the completed torrent data on my NAS in case I need to reseed.  Hope this helps you in some way.  Get creative, pyroscope is awesome.

Good luck!

--
You received this message because you are subscribed to the Google Groups "pyroscope-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyroscope-use...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

pyroscope

unread,
May 2, 2015, 5:01:04 PM5/2/15
to pyrosco...@googlegroups.com
The smoothest solution would be a check done in the queue manager, before an item is actually started. Any solution in rtorrent.rc can lead to a non-reactive UI, and other problems.

If you fancy that, open a feature request in the issue tracker of 'pyrocore' – refer to this thread.

Krisztian Kovacs

unread,
May 6, 2015, 7:46:03 AM5/6/15
to pyrosco...@googlegroups.com
Cheers, that would be awesome! I'll create a new issue for this on github (when it will be working again :) ).

Until then I'll try to implement a loop which will check the free space and the data size of the downloadable torrents and the size of the deletable torrents with the help of lstor (then delete the metafile itself):

$ ./bin/lstor -q -o __size__ "/mnt/Torrents/.rtorrent/.torrent/Foo bar.torrent"
1270509844

If I get to something valueable I'll share it here. (I have to be careful, since I want to delete data recursivebly : if something goes wrong all my torrents will be vanished! :) )

@Pat: thanks for the idea, but it's not good for me, since I want to deal with this automatically.

pyroscope

unread,
May 6, 2015, 5:35:03 PM5/6/15
to pyrosco...@googlegroups.com, chr...@gmail.com
    rc=0
   
while test $(bytes_free) -lt $needed -a $rc -ne 44; do
        rtcontrol
-/1 --cull active=+4h xfer=0 prio=-3 is_ignored=n \

           
-qco loaded,size.sz,uploaded.sz,seedtime,ratio,name $cond ; rc=$?
        test $rc
-eq 0 -o $rc -eq 44 || fail "rtcontrol aborted with RC=$rc"

   
done

Basically that, $cond is the juicy part, and can be "-s loaded loaded=+7d path=//tv//" for example. It's slow (only one delete per run), but safe, unless you set $needed > your hdd size.

pyroscope

unread,
May 6, 2015, 5:41:43 PM5/6/15
to pyrosco...@googlegroups.com, chr...@gmail.com

Krisztian Kovacs

unread,
Jun 23, 2015, 9:51:02 AM6/23/15
to pyrosco...@googlegroups.com, chr...@gmail.com
Thanks, for the great idea (to put the checking into the queue part)!
I wrote my shell version of it, and it's working fine for about 3 weeks now!
When I'll separate them (queue manager, deleting old torrents) from the main script, I'll post it here.

2015. május 6., szerda 22:41:43 UTC+1 időpontban pyroscope a következőt írta:
Reply all
Reply to author
Forward
0 new messages