0o120 / pyruTorrent

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pyruTorrent

This was used for personal use, consider it experimental and use at own risk.

Install

pip install pyruTorrent

Usage

Incomplete docs

Create Instance

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',
)

Add Torrent

# :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
)

Get Torrent

# Returns single torrent

rt.get_torrent(
	'<torrent-hash>',
	include_trackers=False,
	include_files=False,
	include_peers=False
)

Get Torrents

# 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>'])

Start

rt.start('<torrent-hash>')

Stop

rt.stop('<torrent-hash>')

Pause

rt.pause('<torrent-hash>')

Start All

rt.start_all(view='default', ratio_group=None)

Stop All

rt.stop_all(view='default', ratio_group=None)

Pause All

rt.pause_all(view='default', ratio_group=None)

Remove

rt.remove('<torrent-hash>')

Remove and Delete Files

rt.remove_and_delete('<torrent-hash>')

Remove All

rt.remove_all(view='default', ratio_group=None)

Remove All and Delete Files

rt.remove_and_delete_all(view='default', ratio_group=None)

Check Hash

rt.check_hash('<torrent-hash>')

Check Hash All

rt.check_hash_all(view='default', ratio_group=None)

Remote Ratio Group

rt.remove_ratio_group(['<torrent-hash>', '<torrent-hash>', '<torrent-hash>'])

Set Ratio Group

rt.set_ratio_group(['<torrent-hash>', '<torrent-hash>', '<torrent-hash>'], 2)

Get Settings

rt.get_settings()

Set Settings

rt.set_settings({'min_peers': 1, 'max_peers': 200})

Get Download Directory

# Returns default download directory

rt.get_download_directory()

Get Torrent Views

# Returns default download directory

rt.get_views()

About


Languages

Language:Python 100.0%