I have used a couple of peer-to-peer clients that have an option to prevent the user from downloading a file twice, either by gently asking for confirmation, or by refusing to add a new download unless forced. This is quite helpful, because it reminds me to check my filesystem for e.g. the PlaneShift installer before downloading it again.

Obviously this requires keeping a history of everything that has been downloaded, and a check before starting each download, along with a user dialog or two.

I am now using rtorrent for the BitTorrent protocol and I have yet to find a way to prevent me from downloading a file twice. rtorrent does do that for files that it is still downloading or seeding, but not for anything that has been removed from its view.

I thought about keeping track of which .torrent files I download, but things get more complex with Magnet links and multiple .torrent files for the same download.

Is there a way to have rtorrent keep track of the actual download (e.g. its hash) and prevent me from downloading it twice? Or, perhaps, some external tool that will do that for me?


You can use rtorrent's triggers and scripting abilities.

I haven't done exactly what you are asking for myself, but similar things. E.g. I have a session running with the following entries in rtorrent.rc:

schedule = 

system.method.set_key =
    "d.set_directory=$d.get_custom1= ;
        $d.get_custom1= ;

(line breaks added for clarity).

This moves finished downloads to a path $d.get_custom1 that is set as the downloads are started (ignore $d.get_custom2 - used for a different purpose, but I keep it as an example).

As you can see, external scripts are executed and their return values are caught by rtorrent. By having external scripts that keep track of what you have downloaded (e.g. writing hash or file name to a log file/database for finished downloads) and check new downloads against this list (grep or DB utility) and act on this, you can achieve what you want.

A complete run-down of rtorrent's scripting abilities is far too comprehensive - see the manual and online resources. I'm not saying it is self-evident or easy - certainly not - but it is possible :-) .

|improve this answer|||||
  • I used a couple of scripts, along with execute_nothrow and a branch= statement to keep track of the hashes of all completed torrents and stop a torrent automatically if it has been previously downloaded. A message is printed; if I want to re-download anyway, all I have to do is start the torrent... – thkala Sep 9 '12 at 20:44

See https://code.google.com/p/pyroscope/wiki/QueueManager#Configuration for an example where:

  1. some files within a torrent aren't downloaded (by setting their priority to 0), and
  2. some torrents that are loaded aren't auto-started (the "audio with lots of graphics" use-case).

As you can see those are quite complex conditions, it's just a matter of adding the custom (Python) code.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for?Browse other questions tagged or ask your own question.