Changes between Initial Version and Version 1 of archive/libtorrent.rakshasa.no/RTorrentCommonTasks


Ignore:
Timestamp:
08/08/15 16:29:48 (9 years ago)
Author:
Gabor Hudiczius
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • archive/libtorrent.rakshasa.no/RTorrentCommonTasks

    v1 v1  
     1[[libtorrentMirror]]
     2
     3= Common Tasks in rTorrent for Dummies =
     4
     5This page is for showing examples on how to use the many options in rTorrent. Only real examples you can apply immediately, no theory at all.
     6
     7[[PageOutline(2,,inline)]]
     8
     9
     10== Saving torrent state and resume data between sessions ==
     11
     12{{{
     13# Point to a directory where rTorrent will save the torrent files. You
     14# may also use relative paths if you want different session
     15# directories depending on where you execute rtorrent.
     16#
     17# session = ./session
     18
     19session = ~/Download/session
     20}}}
     21
     22== Watch a directory for torrents ==
     23
     24{{{
     25# Watch a directory for new torrents, restart torrents that have been
     26# copied back and stop those that have been deleted.
     27
     28schedule = watch_directory,10,10,load_start=~/Download/watch/*.torrent
     29schedule = tied_directory,10,10,start_tied=
     30schedule = untied_directory,10,10,close_untied=
     31
     32# Watch another directory with a different destination. (0.7.7+)
     33
     34schedule = watch_directory_2,10,10,"load_start=~/Download/watch_stuff/*.torrent,d.set_directory=~/Download/stuff/"
     35}}}
     36
     37
     38== Create symbolic links to indicate the download state ==
     39
     40{{{
     41# Create symlinks in the watch directory with a suffix indicating the
     42# download state.
     43
     44on_start    = link1,"create_link=tied,,.started"
     45on_stop     = link1,"delete_link=tied,,.started"
     46on_finished = link1,"create_link=tied,,.finished"
     47on_erase    = link1,"delete_link=tied,,.finished"
     48
     49# Create symlinks in the same directory as the download.
     50
     51on_start    = link2,"create_link=base_path,,.started"
     52on_stop     = link2,"delete_link=base_path,,.started"
     53on_finished = link2,"create_link=base_path,,.finished"
     54on_erase    = link2,"delete_link=base_path,,.finished"
     55
     56# Create a symlink in another directory without a suffix.
     57# You need to quote the command in this case.
     58
     59on_finished = link3,"create_link=base_filename,/files,"
     60}}}
     61
     62
     63== Move completed torrents ==
     64
     65When the torrent finishes, it executes "mv <base_path> ~/Download/"
     66and then sets the destination directory to "~/Download/". (0.8.4+)
     67
     68{{{
     69system.method.set_key = event.download.finished,move_complete,"execute=mv,-u,$d.get_base_path=,~/Download/;d.set_directory=~/Download/"
     70
     71# On MacOSX and *BSD.
     72system.method.set_key = event.download.finished,move_complete,"execute=mv,-n,$d.get_base_path=,~/Download/;d.set_directory=~/Download/"
     73}}}
     74
     75For versions 0.7.7 to 0.8.3 use this:
     76{{{
     77on_finished = move_complete,"execute=mv,-u,$d.get_base_path=,~/Download/ ;d.set_directory=~/Download/"
     78
     79# On MacOSX and *BSD.
     80on_finished = move_complete,"execute=mv,-n,$d.get_base_path=,~/Download/ ;d.set_directory=~/Download/"
     81}}}
     82
     83== Move completed torrents to different directory depending on watch directory ==
     84
     85Each watch directory adds torrents with the final destination stored
     86in the "custom1" string of the download. You can check this string with
     87ctrl-X then "print=$d.get_custom1=" in the client. In rtorrent 0.8.4+:
     88
     89{{{
     90schedule = watch_directory_1,10,10,"load_start=~/Download/watch_stuff1/*.torrent,d.set_custom1=~/Download/stuff1/"
     91schedule = watch_directory_2,10,10,"load_start=~/Download/watch_stuff2/*.torrent,d.set_custom1=~/Download/stuff2/"
     92
     93# On completion, move the torrent to the directory from custom1.
     94system.method.set_key =event.download.finished,move_complete,"d.set_directory=$d.get_custom1= ;execute=mv,-u,$d.get_base_path=,$d.get_custom1="
     95
     96# On MacOSX and *BSD.
     97system.method.set_key =event.download.finished,move_complete,"d.set_directory=$d.get_custom1= ;execute=mv,-n,$d.get_base_path=,$d.get_custom1="
     98}}}
     99
     100For versions 0.7.7 to 0.8.3 use this on_finished handler instead:
     101{{{
     102on_finished = move_complete,"execute=mv,-u,$d.get_base_path=,$d.get_custom1= ;d.set_directory=$d.get_custom1="
     103
     104# On MacOSX and *BSD.
     105on_finished = move_complete,"execute=mv,-n,$d.get_base_path=,$d.get_custom1= ;d.set_directory=$d.get_custom1="
     106}}}
     107
     108== Move .torrent file after loading it manually ==
     109
     110Do NOT use this if in combination with a watch folder!
     111
     112When loading a torrent manually (i.e. 'load' and 'load_start'), moves the original XXX.torrent file to a directory (for example you may want to move the file to the trash bin,  since rtorrent made a copy of it in the session directory).
     113
     114{{{
     115# 0.8.4+ Linux
     116system.method.set_key = event.download.inserted_new,move_tor,"execute=mv,-u,$d.get_loaded_file=,/path/to/trash_bin"
     117
     118# 0.8.4+ MacOSX and *BSD.
     119system.method.set_key = event.download.inserted_new,move_tor,"execute=mv,-n,$d.get_loaded_file=,/path/to/trash_bin"
     120}}}
     121
     122
     123== Send email for completed downloads ==
     124For 0.8.4+
     125{{{
     126# First and only argument to rtorrent_mail.sh is completed file's name (d.get_name)
     127system.method.set_key = event.download.finished,notify_me,"execute=~/rtorrent_mail.sh,$d.get_name="
     128}}}
     129
     130Assuming you have a working mail system and this script is executable.
     131
     132rtorrent_mail.sh :
     133{{{
     134#!/bin/sh
     135echo "$(date) : $1 - Download completed." | mail -s "[rtorrent] - Download completed : $1" alerts@example.com
     136}}}
     137
     138== Stop torrents after reaching a specified upload ratio ==
     139
     140For rTorrent 0.8.4 please see [wiki:RTorrentRatioHandling].
     141
     142For versions before 0.8.4:
     143{{{
     144# stop_on_ratio = min_ratio,min_upload,max_ratio
     145#
     146# Example:
     147
     148schedule = ratio,60,60,"stop_on_ratio=200,50M,300"
     149}}}
     150
     151The "stop_on_ratio" command can be scheduled to stop torrents that have reached a specified upload ratio. The above example will stop a torrent once it has uploaded 200% of the torrent size, unless less than 50MB has been uploaded and the ratio is below 300%.
     152
     153Use shift-I to make a torrent ignore this and other commands.
     154
     155== Delete data files when removing incomplete downloads ==
     156
     157If you often add older torrents and find that they never complete due to lack of seeds, these commands will automatically delete the data files when removing an incomplete download (either manually or with remove_untied by removing the tied file). Note that all files will be removed on incomplete or partially complete downloads, even those files from it which are in fact completely downloaded.
     158
     159'''WARNING:''' Do not use this setup if you ever change a download's base_path to something like /home/bob/ or similar, or you could lose a lot of files!
     160
     161{{{
     162# Enable removal for all downloads added from this watch directory.
     163schedule = watch_directory,10,10,"load_start=~/Download/watch_stuff/*.torrent,d.set_custom2=1"
     164
     165# Clear custom2 when download completes.
     166on_finished = set_done_var,d.set_custom2=
     167
     168# Erase data files when a download is removed that still has custom2 set.
     169on_erase = rm_files,"branch=d.get_custom2=,\"execute={rm,-rf,--,$d.get_base_path=}\""
     170}}}
     171
     172To make an incomplete download exempt from the automated deletion on removal, select the download then press Ctrl-X and enter "d.set_custom2=".
     173
     174== Scheduling download rate ==
     175
     176{{{
     177schedule = throttle_1,01:00:00,24:00:00,download_rate=0
     178schedule = throttle_2,05:00:00,24:00:00,download_rate=25
     179}}}
     180
     181Every day "throttle_1" gets triggered at 01:00 and sets the download rate to unlimited, while "throttle_2" sets it to 25kb at 05:00. Using this the client may be made to perform a somewhat crude form of bandwidth scheduling.
     182
     183== Using custom throttles ==
     184
     185Since rtorrent 0.8.5, you can define different throttle rates for (groups of) downloads or IP ranges. These throttles borrow bandwidth from the global throttle and thus are limited by it too.
     186
     187{{{
     188throttle_up=slowupload,10
     189throttle_down=slowdownload,50
     190throttle_up=sloweverything,10
     191throttle_down=sloweverything,50
     192throttle_ip=NULL,192.168.0.0/16
     193}}}
     194The "slowupload" throttle limits the upload to 10 kb/s. The "slowdownload" throttle limits download to 50 kb/s. The "sloweverything" throttle limits both.
     195
     196You can assign throttles to a stopped download with Ctrl-T. The NULL throttle is a special unlimited throttle that bypasses the global throttle.
     197
     198Ticket #20 has some more detailed instructions throughout the comments block.
     199
     200== Using a different configuration file ==
     201
     202{{{
     203$ rtorrent -n -o import=~/foo.rc
     204}}}
     205
     206The '-n' switch tells rtorrent not to load the default resource file, while the import option loads '~/foo.rc'.
     207
     208== Adding fast resume data to torrent files ==
     209
     210When you are the first seeder for a torrent, rTorrent will normally have to hash-check all files even if you just created the torrent file from them and thus know that they are correct.  To eliminate this step, the following Perl script by Josef Drexler can add rTorrent's fast resume data to the torrent file: [http://libtorrent.rakshasa.no/downloads/rtorrent_fast_resume.pl].
     211
     212Usage:
     213{{{
     214$ rtorrent_fast_resume.pl [base-directory] < original.torrent > modified.torrent
     215}}}
     216
     217Then you can distribute the original torrent file and load the modified file into rTorrent and start seeding without needing a hash check. The base directory specifies where the files in the torrent are located, equivalent to the "directory" option in rtorrent.rc. If not specified, the files are assumed to be in the current directory.
     218
     219Note that this script requires the Convert::Bencode module from CPAN, if this module is not available on your system you will need to install it first:
     220{{{
     221$ perl -MCPAN -e 'install Convert::Bencode'
     222}}}
     223
     224
     225== Starting rTorrent on System Startup ==
     226=== Debian ===
     227Step 1: Assuming a Debian-based distribution, create /etc/init.d/rtorrent with one of the [http://libtorrent.rakshasa.no/wiki/RTorrentCommonTasks#tkt-changes-hdr rtorrentInit files] attached to this page, editing the Configuration to suit your needs.
     228
     229Step 2: Make sure it has appropriate permissions:
     230{{{
     231# ls -l /etc/init.d/rtorrent
     232-rwxr-xr-x 1 root root 3000 2007-03-06 22:40 /etc/init.d/rtorrent
     233}}}
     234
     235Step 3: Update your init system (as sudo/su/root):
     236{{{
     237# update-rc.d rtorrent defaults
     238}}}
     239
     240=== Gentoo ===
     241Step 1: Assuming a Gentoo distribution, and having the '''daemon''' USE flag enabled ; select the user you want rtorrent to be runned as modifying /etc/conf.d/rtorrentd
     242
     243Step 2: Update your init system (as sudo/su/root):
     244{{{
     245# rc-update add rtorrentd default
     246}}}
     247
     248== Using custom views ==
     249Show downloads currently uploading or downloading in active view. Update every 30 seconds.
     250{{{
     251schedule = filter_active,30,30,"view_filter = active,\"or={d.get_up_rate=,d.get_down_rate=}\""
     252}}}
     253
     254Show downloads currently downloading in active view. Update every 30 seconds.
     255{{{
     256schedule = filter_active,30,30,"view_filter = active,d.get_down_rate="
     257}}}
     258
     259Show downloads currently uploading in active view. Update every 30 seconds.
     260{{{
     261schedule = filter_active,30,30,"view_filter = active,d.get_up_rate="
     262}}}
     263
     264Switch to a custom view with
     265{{{
     266ui.current_view.set = viewname
     267}}}
     268
     269== Start or stop all torrents ==
     270In the userinterface:
     271{{{
     272^x d.multicall=,d.start=
     273}}}
     274Replace d.start= with d.stop= to stop all torrents