RTorrentXMLRPCGuide

Using XMLRPC with rtorrent

Since version 0.7.5, rtorrent has a built-in XMLRPC interface (if enabled). Recommendations for secure usage will come later, just make sure you are aware of the implications of opening the XMLRPC port. See RTorrentCommands for an incomplete list of commands. Installation &amp; Configuration What you need:  http://python.ca/scgi/  for Apache, Lighttpd should have this built-in.  http://xmlrpc-c.sourceforge.net/  1.00 or later, 1.07 or later for 64bit integer support.

rtorrent 0.7.5 or later.  Configure rtorrent with the --with-xmlrpc-c flag and add the following to: httpd.conf: SCGIMount /RPC2 127.0.0.1:5000 rtorrent.rc: scgi_port = localhost:5000 For lighttpd: rtorrent.rc: scgi_local = /home/user/rtorrent/rpc.socket

lighttpd.conf: scgi.server = (               "/RPC2" =&gt;                  ( "127.0.0.1" =&gt; (                     "socket" =&gt; "/home/user/rtorrent/rpc.socket",                      "check-local" =&gt; "disable",                      "disable-time" =&gt; 0,  # don't disable scgi if connection fails                    ) )             )

The web server will now route xmlrpc requests to rtorrent, which is listening only on connections from the local machine or on the local socket file. Also make sure the /RPC2 location is properly protected. To make it accessible from anywhere, use "scgi_port = :5000". This is however not recommend as rtorrent has no access control, which means the http server is responsible for handling that. Anyone who can send rtorrent xmlrpc commands is likely to have the ability to execute code with the privileges of the user running rtorrent. You may also use "scgi_local = /foo/bar" to create a local domain socket, which supports file permissions. Set the rw permissions of the directory the socket will reside in to only allow the necessary processes. This is the recommended way of using XMLRPC with rtorrent, though not all http servers support local domain sockets for scgi. <h2 id="Usage">Usage Access the XMLRPC interface using any XMLRPC-capable client. For example, using the xmlrpc utility that comes with xmlrpc-c: &gt; # To list all the xmlrpc methods rtorrent supports. &gt; xmlrpc localhost system.listMethods

&gt; # Get max upload rate. &gt; xmlrpc localhost get_upload_rate

&gt; # Set upload rate, exact 100000 bytes. &gt; xmlrpc localhost set_upload_rate i/100000

&gt; # Set upload rate, 100kb. &gt; xmlrpc localhost set_upload_rate 100k

&gt; # See list of downloads in "main" view &gt; xmlrpc localhost download_list

&gt; # See list of downloads in "started" view &gt; xmlrpc localhost download_list started

&gt; # Get uploaded bytes for specific download by info-hash &gt; xmlrpc localhost d.get_up_total e66e7012b8346271009110ac38f91bc0ad8ce281

&gt; # Change the directory for a specific download. &gt; xmlrpc localhost d.set_directory 91A2DF0C9288BC4C5D03EC8D8C26B4CF95A4DBEF foo/bar/

&gt; # Size of the first file in a specific download. &gt; xmlrpc localhost f.get_size_bytes 91A2DF0C9288BC4C5D03EC8D8C26B4CF95A4DBEF i/0

It supports both single strings akin to what the option file accepts, and proper xmlrpc integer, string and lists. See the man page and the rtorrent/src/command_* source files for more details on what parameters some of the commands take.