This was used for personal use, consider it experimental and use at own risk.
pip install pyruTorrent
Incomplete docs
from pyruTorrent import rTorrent
rt = rTorrent(
host='xxxxxxxxxx',
port=123456,
username='xxxxxxxxxx',
password='xxxxxxxxxx',
rpc_path='/rutorrent/plugins/httprpc/action.php'
)
# or
rt = rTorrent(
uri='https://<username>:<password>@<host>:<port>/rutorrent/plugins/httprpc/action.php',
)
# :torrent_item: accepts multiple formats
# Ex: <bytes> | [<bytes>] | [<bytes>, <bytes>, <bytes>...]
# Ex: <magnet> | [<magnet>] | [<magnet>, <magnet>, <magnet>...]
# Ex: <path> | [<path>] | [<path>, <path>, <path>]
# Ex: [<magnet>, [<path>], [<bytes>], <magnet>]
# <magnet> the magnet url
# <path> local filepath to .torrent file
# <bytes> byte contents of a .torrent file
# Not recommended to send more than 80 torrents at a time.
# Failiure happens when sending around 100 torrents at once.
#
# :kwargs: Client defaults used if not set
rt.add_torrent(
torrent_item,
download_path=None,
label=None,
ratio_group=None,
add_stopped=False,
add_name_to_path=True,
save_uploaded_torrent=False
)
# Returns single torrent
rt.get_torrent(
'<torrent-hash>',
include_trackers=False,
include_files=False,
include_peers=False
)
# Note:
# With include_trackers, include_files & include_peers enabled,
# response sent from RPC will be double or more in size, depending on
# number of files, peers and trackers.
# Test:
# Test with 1,125 torrents, 1-3 trackers & 0-4 peers per torrent:
# - 1.48MB w/ include_trackers, include_files & include_peers disabled
# - 3.25MB w/ include_trackers, include_files & include_peers enabled
# Returns all torrents if no hashes or ratio_group specified
rt.get_torrents(
hashes=None,
ratio_group=None,
include_trackers=False,
include_files=False,
include_peers=False
)
# Returns torrents matching hashes
rt.get_torrents(['<torrent-hash>', '<torrent-hash>', '<torrent-hash>'])
rt.start('<torrent-hash>')
rt.stop('<torrent-hash>')
rt.pause('<torrent-hash>')
rt.start_all(view='default', ratio_group=None)
rt.stop_all(view='default', ratio_group=None)
rt.pause_all(view='default', ratio_group=None)
rt.remove('<torrent-hash>')
rt.remove_and_delete('<torrent-hash>')
rt.remove_all(view='default', ratio_group=None)
rt.remove_and_delete_all(view='default', ratio_group=None)
rt.check_hash('<torrent-hash>')
rt.check_hash_all(view='default', ratio_group=None)
rt.remove_ratio_group(['<torrent-hash>', '<torrent-hash>', '<torrent-hash>'])
rt.set_ratio_group(['<torrent-hash>', '<torrent-hash>', '<torrent-hash>'], 2)
rt.get_settings()
rt.set_settings({'min_peers': 1, 'max_peers': 200})
# Returns default download directory
rt.get_download_directory()
# Returns default download directory
rt.get_views()