Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

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 = 
    watch_directory_1,10,10,
    "load_start=/path/to/watch/folder/*.torrent,
    d.set_custom1=$execute_capture={/path/to/external/script},
    d.set_custom2=1"

system.method.set_key =
    event.download.finished,
    move_complete,
    "d.set_directory=$d.get_custom1= ;
    execute=mv,-u,
        $d.get_base_path=,
        $d.get_custom1= ;
    execute=/path/to/another/external/script,
        $d.get_name=,
        $d.get_custom1=,
        $d.get_custom2="

(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 :-) .

share|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
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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