RTorrent Service Add-on

This addon contains rtorrent, rutorrent, dtach, upnpc, php-cgi and some scripts I have created.


 * rTorrent BitTorrent client can handle multiple watch dirs and post actions.
 * ruTorrent is a very good web front-end for rTorrent.

By default this addon will move downloads from the selected downloads folder to the selected complete folder upon download completion.

Very good for XBMC Library mode. :)

Addon Description
How this add-ons configuration page is intended to work:

Under "Watch Settings" you can set base folders, this is the defaults: Torrent Base Directory:  /storage/downloads/torrents/ Download Base Directory: /storage/downloads/ Complete Base Directory: /storage/

Then you can set Watch folders, separated by: "," videos,tvshows,music

What will happen then is:

Directories while be created if they don't exist: /storage/downloads/torrents/videos /storage/downloads/videos /storege/videos

Then rtorrent will start detached.

Now if you add a torrent file to the "Downloads share" --> torrents --> videos

It will start to download to /storage/downloads/videos and on completion it will be moved to /storage/videos

The same for every watch dir added, if you use the default Move on complete action.

If you install the Watchdog XBMC add-on and then include the tvshows, videos and music dirs to the Library, newly downloaded things will be added to the Library automatically.

If you dont want post actions you can set on complete action to None and nothing will happen.

OpenELEC 3.0
service.downloadmanager.rTorrent-3.0.8-i386.zip

service.downloadmanager.rTorrent-3.0.8-x86_64.zip

service.downloadmanager.rTorrent-3.0.8-arm.zip (RPi)

OpenELEC 3.1+
For OpenELEC 3.1 and above rTorrent service add-on is included in OpenELEC unofficial add-ons repo here

After installing the repo rTorrent Add-on can be installed from: Settings --> Add-ons --> Get Add-ons --> Unofficial OpenELEC Mediacenter OS Add-ons --> Services --> rTorrent

Install
Grab a copy of the addon or the unofficial addons repo, for your arch from Downloads here.

Copy it to OpenELEC Box and use install from zip inside XBMC

Settings --> Add-ons --> Install from zip

NOTE: At least reboot once after fresh install.

Usage
REMEMBER: When changing settings, in addon configuration menu you need to disable and re-enable the addon again.

For better user experience rTorrent can be managed through the ruTorrent web front-end

ruTorrent on a remote web browser http://openelec:8181 or http://"OpenELEC Box IP":8181 For ruTorrent usage please refer to: http://code.google.com/p/rutorrent/wiki/Usage

You can also use the XBMC program add-on rTorrent

To Install this enter: System -> Add-ons -> Get add-ons -> XBMC.org Add-ons -> Program Add-ons -> rTorrent

To access rTorrent program addon, if installed Programs -> rTorrent

You can use this to stop, start, pause torrents and to monitor the progress of existing downloads. You can also set download priority.

Adding Torrents to Watch dirs
Now the easiest way to add torrents in my opinion is to add them to the watch dirs. this is done through the samba share "Downloads" on the OpenELEC Box

Please read the Accessing_Samba_Shares wiki page if you dont know how to access this share

in the Downloads share you now have a folder called "torrents" under this folder you have the sub folders music videos and tvshows

if you are downloading a TV show place the torrent file in the tvshows folder here, and rtorrent will start to download it...

when it is completed a pop up window will appear in XBMC telling you that it is completed. The downloaded data will be moved to the TV Shows samba share

Now you can play it from Videos --> Files --> TV Shows in XBMC

Adding Torrents in ruTorrent
you can add torrents in the ruTorrent web-ui if you save the data to one of the directors that match the watch dirs it will be sorted on completion.

from version 3.1.9 of the rTorrent service addon you can use labels for sorting too.

Note on label sort: multilevel dirs is supported by adding labels like tvshows/serie.one and so on in ruTorrent. With default settings data will be moved to /storage/tvshows/serie.one/ on completion if the above label was used.

No need to care about download dirs any more, you can save torrent data to any download dir and it will be sorted on complete any way!! :)

I can recommend using ruTorrent addon for Firefox or the Remote Torrent Addr for Chrome, it makes it really easy to add torrent from a remote web browser :-)

Also the Transdroid Android app supports setting labels!!

External Drives
External drives are automatically mounted in /var/media, there is a link: /media

If your external drives filesystem is FAT32, NTFS or some other non-Linux filesystem rtorrent can fail to sync to disk properly.

If your torrents are rehashed at every reboot you need to add safe_sync = yes to the rtorrent.rc: echo "safe_sync = yes" >> /storage/.xbmc/userdata/addon_data/service.downloadmanager.rTorrent/rtorrent.rc reboot let all torrents rehash once then reboot again and see if your good.

Network Shares
To use Network shares you need to mount it in the OpenELEC OS, adding a share in XBMC is not the same.

There is a Guide here on how to mount Network shares in OpenELEC: Mounting_network_shares

When you have your share mounted you need to create a link from /var/media to /storage/media

Using External Storage
You need to create this link to be able to use External drives or Network shares from the ruTorrent web-ui ln -sf /var/media /storage/media ruTorrent web-ui is limited to /storage and cant reach outside of it.

/var/media is the default mount point so your external drive or network drive can now be reached as /storage/media/"drive"

Now to use the mounted drive instead of the OpenELEC Storage partition you need to change Watch Settings in rTorrent add-on Configuration menu:

Under "Watch Settings" you need to change the Base Directory's: Torrent Base Directory:  /storage/downloads/torrents/ Download Base Directory: /storage/media/"drive"/downloads Complete Base Directory: /storage/media/"drive" As you can see the Torrent Directory can stay the same, we only change the Download Directory and the Complete Directory.

when you restart this folders will be created: /storage/media/"drive"/downloads/videos /storage/media/"drive"/videos

A torrent added in the /storage/downloads/torrents/video folder will be downloaded in the /storage/media/"drive"/downloads/video folder and on completion it will be moved to /storage/media/"drive"/videos

Also the default download location in ruTorrent will change to /storage/media/"drive"/downloads

TIP! If you use network shares it is highly recommended to enable Wait for network before starting XBMC option in OE settings under Network.

Important: If the drive is not mounted on boot rtorrent will restart all downloads in the Storage partition!!

Accessing rTorrent CLI
rtorrent runs in a detached console screen.

To connect to this console screen, login as root with ssh and run: dtach -a /tmp/rtorrent.dtach -z

To detach again hit "CTRL+\"

Configure Transdroid
All available torrent apps for Android works. That support rtorrent that is...

Use this settings in Transdroid, works in other apps to.

server type:         rtorrent server name/IP:      "ip of your OE box" port:                "rutorrent port" default: 8181 RPC2path or SCGImapp: /plugins/httprpc/action.php

Your phone needs to be on the same network as the OpenELEC box for this to work.

Configure ruTorrent RSS
The ruTorrent web front-end is installed with the RSS plugin that can auto download torrent files from rss feeds.

For ruTorrent RSS auto downloading read the ruTorrent PluginRSS Guide

For more advanced filtering examples read This

Customization
I want more!! and yes I know some Linux...

Blocklists
From version 3.0.7 and onward blocklists are supported and working in rTorrent

To use it add this line to the rtorrent.rc file: /storage/.xbmc/userdata/addon_data/service.downloadmanager.rTorrent/rtorrent.rc ipv4_filter.load="/path/to/blocklist/file",unwanted If you whant it schedualed to reload the list every 24h add this instead: schedule = load_filter,0,24:00:00,"ipv4_filter.load=/path/to/blocklist/file,unwanted" Restart rTorrent and it will start to block.

Blocklist file can be in CIDR or P2P format with comments.

ruTorrnet Plugins
ruTorrent plugins can be added to the ruTorrent plugins dir: /storage/.xbmc/addons/service.downloadmanager.rTorrent/rutorrent/plugins NOTE: Some plugins have system dependencies and might not work on OpenELEC.

This plugins are already included: cpuload, diskspace, _getdir, rss, seedingtime, data, datadir, erasedata, scheduler, extsearch, httprpc, ratio

rTorrent Logging
To enable logging in rtorrent add this at top of: /storage/.xbmc/userdata/addon_data/service.downloadmanager.rTorrent/rtorrent.rc log.open_file = "rtorrent.log", "/tmp/rtorrent.log" log.add_output = "debug", "rtorrent.log" Restart rTorrent and it will start to log to: /tmp/rtorrent.log

Restart rTorrent
Ether disable/enable the addon or run from CLI: killall -INT rtorrent

connection to rTorrent not established
You have installed the wrong version of the rTorrent addon.

If you are running OpenELEC 3.1 or newer you need to use the OpenELEC unofficial add-ons repo and install rTorrent add-on from there.

Changelog
3.1.10 - ruTorrent upgraded to 3.6 old version is gone! Changelog: http://code.google.com/p/rutorrent/wiki/Versions - fixed rutorrent label sort on complete action, multiple slashes and spaces now works in labels! - fixed downloaddirs/watchdirs now takes precedence over labels.

3.1.9 - fixed sort series with sNNeNN in name and added option to switch on/off, default is off - added sort based on rutorrent labels function, allways on!! - added RPi tunning to rtorrent.rc - added lbll-suite plugin to ruTorrent web-ui, good at handling labels. if you dont want the sort on complete action you HAVE to disable it in config now or label sort will be used on all downloads

3.0.8 - Fixed php sqlite problem introduced in OE 3.0.4 - added option to sort series with sNNeNN in name to serie.name.sNN dirs - added remove lock file if rtorrent is dead, and restart 3.0.7 - added new patch from @sallyswiss: fixes for ipv4_filter now includes logging. - changed defaults of rTorrent and ruTorrent to enabled, easier to install and run. 3.0.6 - added patch from @sallyswiss: fixes ipv4_filter high memory usage. - ipv4_filter now supports lists in p2p format. - compile optimizations. 3.0.5 - upgraded to rtorrent 0.9.3: fixed announcement interval issue and more - upgraded to rutorrent 3.5: new features and fixes, release notes comming... - upgraded to xmlrpc-c 1.16.44: fixed memory leaks and more - upgraded to libtorrent 0.13.3: fixed announcement interval issue and more - upgraded to libsigc++ 2.3.1: performace optimize and fixes - changed low_diskspace limit on RPi to 100MB and 500MB on others - dont try to sort downloads not in correct dirs - OpenELEC 3.0 support 2.1.4  - OpenELEC 2.0 support !!Does not work on pre RC1!! 2.1.3  - addon name changed form rtorrent to rTorrent, uninstall old addon before upgrade/install. - changed default from Link to Move - added rtorrent upnp support whit miniupnpc - added rutorrent web auth and upnp support - added config options to enable upnp for rtorrent and/or rutorrent - added rutorrent plugin ratio whit seedtime support, try it! - added rutorrent on complete actions support, you need to save data in correct dirs - added on complete script whit notify xbmc function - added library auto update script, enable in config - added default download dir, is base download dir. to support adding torrents from android phones - changed rutorrent rss updateInterval from 30m to 10m - supports android torrent remote apps transdroid and so on...   - fixed rutorrent settings not saved on updates/reinstalls, settings moved to addon home "se update note" - fix addon updates try 1 - fix rtorrent move on complete not working - cleanup of config screan - script fixes/cleanups 2.1.2  -  rtorrent-0.9.2 - rutorrent-2.4 web gui - rutorrent-2.4 web gui plugins: cpuload,diskspace,_getdir,rss,seedingtime,data,datadir,erasedata, scheduler,extsearch and httprpc are included!! - rutorrent plugins are auto started. - Settings for startup download and upload rates in config - Setting for enable disable rutorrent in config - Minor fixes...

Links
Visit the rTorrent website for more details: http://libtorrent.rakshasa.no/

Visit the ruTorrent website for more details: http://code.google.com/p/rutorrent/