LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   rtorrent scripting (https://www.linuxquestions.org/questions/linux-software-2/rtorrent-scripting-785958/)

dilemma 01-31-2010 04:06 AM

rtorrent scripting
 
I am running rtorrent on a remote server mainly for seeding torrents. However, I am also using it to download new media.

I wish to share the downloaded torrent media on the web server. This works great for torrents that have finished downloading, however, for torrents that are in the process of downloading, such as large multi-GiB torrents which have slow seeders or no seeders, this creates an issue.

The problem is that I have set the rtorrent default download directory to be visible on the web server. Which is what I want, so that people can get the downloaded media via a web server. Then, when I drop a new torrent into the directory that rtorrent watches, it will start downloading the media to the web servers visible directory. When it finishes the download, then it works the way that I want. So that the media is available both as a web download and also as a torrent download.

The issue is that when a download is in progress, media that is available on the web server is incomplete.

I can manually close a torrent and manually move the media to a different location, then manually tell rtorrent to use the new location for the torrrent (^o)... but that is doing it manually... and if I need to do this with a large number of torrents, it takes a very long time.

I want to automate that so that I don't have to mess with it at all. A lot of other software such as utorrent and such can do this automatically, but it seems that feature is missing from rtorrent.

rtorrent does offer a scripting function in it's config file that can start a script on completion of a torrent file, however, I have not been able to figure out how to automaticaly stop a torrent seed, move the torrent media to a different location and then tell rtorrent the file is in the new location, then start up the torrent again. Moving a torrents associated media to a new location also initiates a hash check when the torrent is started.

Please note that I am not going to use different software. Since rtorrent is shell based and uses curses, it doesn't require GUI features. That saves something like 150 megs of memory for disk caching, etc. rtorrent kicks MUCH ass for this purpose and it uses a tiny amount of system resources.

I use screen with rtorrent so that it will run without having to be logged into the system.

I also need to limit the bandwidth on Apache so that people can download with the web if they absolutely must, but I would prefer that they used the torrent files. So, I would like to slow down their downloads quite a bit so that more bandwidth is used with rtorrent.

As with most Linux issues, there is more than one way to do something. The problem is, I can't even figure out one of those ways right now.

evo2 01-31-2010 04:28 AM

This is how to automate moving finished downloads in rtorrent:

http://libtorrent.rakshasa.no/wiki/R...pletedtorrents

Cheers,

Evo2.

carbonfiber 01-31-2010 04:30 AM

Here is one idea:

- let download be the directory in which rtorrent stores files that have been downloaded or are currently being downloaded
- let finished be the directory that users are supposed to access via their web browsers

The script (called when a download has finished) would make a symbolic link from finished/$d to download/$d. This has various implications: both download and finished must be accessible via the web server; the web server must follow symlinks.


All times are GMT -5. The time now is 07:15 AM.