Hund


June 4, 2020

How to install rTorrent with the colour-patch in Debian

I installed rTorrent from source code so I could patch it with the colour-patch on my Raspberry Pi the other day and I thought I would document it here as well.

As of writing this post the latest version of rTorrent is 0.9.8 and the latest version of libtorrent is 0.13.8.

Downloading the required files

Start by downloading the source code for rTorrent and libtorrent from their website:

$ wget http://rtorrent.net/downloads/rtorrent-0.9.8.tar.gz http://rtorrent.net/downloads/libtorrent-0.13.8.tar.gz

We then need to download the patch that adds some lovely colours to rTorrent. I used the patch from the package rtorrent-color from the Arch User Repository:

$ wget https://aur.archlinux.org/cgit/aur.git/snapshot/rtorrent-color.tar.gz

Continue to unpack the archives:

$ tar -xvzf rtorrent-0.9.8.tar.gz
$ tar -xvzf libtorrent-0.13.8.tar.gz 
$ tar -xvzf rtorrent-color.tar.gz

Installing the needed dependencies

Install the required dependencies:

# apt-get build-essential build-dep rtorrent libtorrent

Installing libtorrent

Start by going to the folder libtorrent-0.13.8:

$ cd libtorrent-0.13.8

Configure and install the package:

$ ./autogen.sh
$ ./configure --disable-debug
# make install

The flag --disble-debug is optional.

Patching and installing rTorrent

Go to the folder ../rtorrent-0.9.8:

$ cd ../rtorrent-0.9.8

Apply the patch:

$ patch -up1 -i <path to patch>/rtorrent-0.9.8_color.patch

Configure and install the package:

$ ./autogen.sh

You now have two options; to enable or disable remote connections for rTorrent. If you don’t connect to rTorrent via a third party client like ruTorrent or Transdroid I highly suggest you disable the feature.

With support for remote connections:

$ ./configure --disable-debug

Without support for remote connections:

$ ./configure --disable-debug --without-xmlrpc-c

Then continue to install the software:

# make install

Configuring rTorrent

The configuration file for rTorrent is $HOME/.rtorrent.rc and this is the part of the config that adds the colours:

# 0 = black
# 1 = red
# 2 = green
# 3 = yellow
# 4 = blue
# 5 = purple
# 6 = cyan
# 7 = grey
# 8 = dark grey 9 = dark red
#10 = dark green

color_inactive_fg = 3
color_dead_fg = 1
color_active_fg = 6
color_finished_fg = 2

This is my configuration file for rTorrent:

# General settings

max_peers = 200
max_peers_seed = 100
max_uploads = 50
download_rate = 0
upload_rate = 0
session = /home/johan/.rtorrent/session
schedule = low_diskspace,5,60,close_low_diskspace=100M
port_range = 58152-58162
port_random = no
check_hash = no
encryption = allow_incoming,try_outgoing,enable_retry
dht = off
peer_exchange = no

# Colors

## 0 = black
## 1 = red
## 2 = green
## 3 = yellow
## 4 = blue
## 5 = purple
## 6 = cyan
## 7 = grey
## 8 = dark grey 9 = dark red
## 10 = dark green

color_inactive_fg = 3
color_dead_fg = 1
color_active_fg = 6
color_finished_fg = 2

# Notifications

method.set_key = event.download.finished,notify,"execute2=/home/johan/Scripts/rtorrent_notify.sh,$d.name="

# Folders

schedule = watch_directory_torrents, 5, 5, "load.start=/mnt/hdd0/.torrents/*.torrent,d.directory.set=/mnt/hdd0/torrents/"

Notifications

This script (as specified in the configuration file) gets executed every time rTorrent completes a torrent and sends me a message about it via XMPP using sendxmpp:

#!/bin/sh

echo "New torrent!\n\n$1" | /usr/bin/sendxmpp --tls-ca-path="/etc/ssl/certs" -t <My XMPP-account>

If you run rTorrent locally and just want a desktop notification, you can just replace the content with this:

#!/bin/sh

notify-send "New torrent!" "$1"


Meta