Deluge RPC API¶
- class deluge.core.core.Core(listen_interface=None, outgoing_interface=None, read_only_config_keys=None)
- add_torrent_file(filename, filedump, options)
Adds a torrent file to the session.
- Parameters
filename (str) – The filename of the torrent.
filedump (str) – A base64 encoded string of the torrent file contents.
options (dict) – The options to apply to the torrent upon adding.
- Returns
str – The torrent_id or None.
RPC exported method (Auth level: 5)
- add_torrent_file_async(filename, filedump, options, save_state=True)
Adds a torrent file to the session asynchronously.
- Parameters
filename (str) – The filename of the torrent.
filedump (str) – A base64 encoded string of torrent file contents.
options (dict) – The options to apply to the torrent upon adding.
save_state (bool) – If the state should be saved after adding the file.
- Returns
Deferred – The torrent ID or None.
RPC exported method (Auth level: 5)
- add_torrent_files(torrent_files)
Adds multiple torrent files to the session asynchronously.
- Parameters
torrent_files (list of tuples) – Torrent files as tuple of
`` (filename, filedump, options) –
- Returns
Deferred
RPC exported method (Auth level: 5)
- add_torrent_magnet(uri, options)
Adds a torrent from a magnet link.
- Parameters
uri (string) – the magnet link
options (dict) – the options to apply to the torrent on add
- Returns
the torrent_id
- Return type
string
RPC exported method (Auth level: 5)
- add_torrent_url(url, options, headers=None)
Adds a torrent from a URL. Deluge will attempt to fetch the torrent from the URL prior to adding it to the session.
- Parameters
url (string) – the URL pointing to the torrent file
options (dict) – the options to apply to the torrent on add
headers (dict) – any optional headers to send
- Returns
a Deferred which returns the torrent_id as a str or None
RPC exported method (Auth level: 5)
- connect_peer(torrent_id, ip, port)
RPC exported method (Auth level: 5)
- create_account(username, password, authlevel)
RPC exported method (Auth level: 10)
- create_torrent(path, tracker, piece_length, comment, target, webseeds, private, created_by, trackers, add_to_session)
RPC exported method (Auth level: 5)
- disable_plugin(plugin)
RPC exported method (Auth level: 5)
- enable_plugin(plugin)
RPC exported method (Auth level: 5)
- force_reannounce(torrent_ids)
RPC exported method (Auth level: 5)
- force_recheck(torrent_ids)
Forces a data recheck on torrent_ids
RPC exported method (Auth level: 5)
- get_auth_levels_mappings()
RPC exported method (Auth level: 0)
- get_available_plugins()
Returns a list of plugins available in the core
RPC exported method (Auth level: 5)
- get_completion_paths(args)
Returns the available path completions for the input value.
RPC exported method (Auth level: 5)
- get_config()
Get all the preferences as a dictionary
RPC exported method (Auth level: 5)
- get_config_value(key)
Get the config value for key
RPC exported method (Auth level: 5)
- get_config_values(keys)
Get the config values for the entered keys
RPC exported method (Auth level: 5)
- get_enabled_plugins()
Returns a list of enabled plugins in the core
RPC exported method (Auth level: 5)
- get_external_ip()
Returns the external IP address received from libtorrent.
RPC exported method (Auth level: 5)
- get_filter_tree(show_zero_hits=True, hide_cat=None)
returns {field: [(value,count)] } for use in sidebar(s)
RPC exported method (Auth level: 5)
- get_free_space(path=None)
Returns the number of free bytes at path
- Parameters
path (string) – the path to check free space at, if None, use the default download location
- Returns
the number of free bytes at path
- Return type
int
- Raises
InvalidPathError – if the path is invalid
RPC exported method (Auth level: 5)
- get_known_accounts()
RPC exported method (Auth level: 10)
- get_libtorrent_version()
Returns the libtorrent version.
- Returns
the version
- Return type
string
RPC exported method (Auth level: 5)
- get_listen_port()
Returns the active listen port
RPC exported method (Auth level: 5)
- get_magnet_uri(torrent_id)
RPC exported method (Auth level: 5)
- get_path_size(path)
- Returns the size of the file or folder ‘path’ and -1 if the path is
inaccessible (non-existent or insufficient privileges)
RPC exported method (Auth level: 5)
- get_proxy()
Returns the proxy settings
- Returns
dict – Contains proxy settings.
Notes
- Proxy type names:
0: None, 1: Socks4, 2: Socks5, 3: Socks5 w Auth, 4: HTTP, 5: HTTP w Auth, 6: I2P
RPC exported method (Auth level: 5)
- get_session_state()
Returns a list of torrent_ids in the session.
RPC exported method (Auth level: 5)
- get_session_status(keys)
Gets the session status values for ‘keys’, these keys are taking from libtorrent’s session status.
See: http://www.rasterbar.com/products/libtorrent/manual.html#status
- Parameters
keys (list) – the keys for which we want values
- Returns
a dictionary of {key: value, …}
- Return type
dict
RPC exported method (Auth level: 5)
- get_torrent_status(torrent_id, keys, diff=False)
RPC exported method (Auth level: 5)
- get_torrents_status(filter_dict, keys, diff=False)
returns all torrents , optionally filtered by filter_dict.
RPC exported method (Auth level: 5)
- glob(path)
RPC exported method (Auth level: 5)
- is_session_paused()
Returns the activity of the session
RPC exported method (Auth level: 5)
- move_storage(torrent_ids, dest)
RPC exported method (Auth level: 5)
- pause_session()
Pause the entire session
RPC exported method (Auth level: 5)
- pause_torrent(torrent_id)
Pauses a torrent
RPC exported method (Auth level: 5)
- pause_torrents(torrent_ids=None)
Pauses a list of torrents
RPC exported method (Auth level: 5)
- prefetch_magnet_metadata(magnet, timeout=30)
Download magnet metadata without adding to Deluge session.
Used by UIs to get magnet files for selection before adding to session.
- Parameters
magnet (str) – The magnet URI.
timeout (int) – Number of seconds to wait before canceling request.
- Returns
Deferred – A tuple of (torrent_id (str), metadata (dict)) for the magnet.
RPC exported method (Auth level: 5)
- queue_bottom(torrent_ids)
RPC exported method (Auth level: 5)
- queue_down(torrent_ids)
RPC exported method (Auth level: 5)
- queue_top(torrent_ids)
RPC exported method (Auth level: 5)
- queue_up(torrent_ids)
RPC exported method (Auth level: 5)
- remove_account(username)
RPC exported method (Auth level: 10)
- remove_torrent(torrent_id, remove_data)
Removes a single torrent from the session.
- Parameters
torrent_id (str) – The torrent ID to remove.
remove_data (bool) – If True, also remove the downloaded data.
- Returns
bool – True if removed successfully.
- Raises
InvalidTorrentError – If the torrent ID does not exist in the session.
RPC exported method (Auth level: 5)
- remove_torrents(torrent_ids, remove_data)
Remove multiple torrents from the session.
- Parameters
torrent_ids (list) – The torrent IDs to remove.
remove_data (bool) – If True, also remove the downloaded data.
- Returns
list –
- An empty list if no errors occurred otherwise the list contains
tuples of strings, a torrent ID and an error message. For example:
[(‘<torrent_id>’, ‘Error removing torrent’)]
RPC exported method (Auth level: 5)
- rename_files(torrent_id, filenames)
Rename files in
torrent_id
. Since this is an asynchronous operation by libtorrent, watch for the TorrentFileRenamedEvent to know when the files have been renamed.- Parameters
torrent_id (string) – the torrent_id to rename files
filenames (((index, filename), ...)) – a list of index, filename pairs
- Raises
InvalidTorrentError – if torrent_id is invalid
RPC exported method (Auth level: 5)
- rename_folder(torrent_id, folder, new_folder)
Renames the ‘folder’ to ‘new_folder’ in ‘torrent_id’. Watch for the TorrentFolderRenamedEvent which is emitted when the folder has been renamed successfully.
- Parameters
torrent_id (string) – the torrent to rename folder in
folder (string) – the folder to rename
new_folder (string) – the new folder name
- Raises
InvalidTorrentError – if the torrent_id is invalid
RPC exported method (Auth level: 5)
- rescan_plugins()
Re-scans the plugin folders for new plugins
RPC exported method (Auth level: 5)
- resume_session()
Resume the entire session
RPC exported method (Auth level: 5)
- resume_torrent(torrent_id)
Resumes a torrent
RPC exported method (Auth level: 5)
- resume_torrents(torrent_ids=None)
Resumes a list of torrents
RPC exported method (Auth level: 5)
- set_config(config)
Set the config with values from dictionary
RPC exported method (Auth level: 5)
- set_torrent_auto_managed(torrent_id, value)
Deprecated: Use set_torrent_options with ‘auto_managed’
RPC exported method (Auth level: 5)
- set_torrent_file_priorities(torrent_id, priorities)
Deprecated: Use set_torrent_options with ‘file_priorities’
RPC exported method (Auth level: 5)
- set_torrent_max_connections(torrent_id, value)
Deprecated: Use set_torrent_options with ‘max_connections’
RPC exported method (Auth level: 5)
- set_torrent_max_download_speed(torrent_id, value)
Deprecated: Use set_torrent_options with ‘max_download_speed’
RPC exported method (Auth level: 5)
- set_torrent_max_upload_slots(torrent_id, value)
Deprecated: Use set_torrent_options with ‘max_upload_slots’
RPC exported method (Auth level: 5)
- set_torrent_max_upload_speed(torrent_id, value)
Deprecated: Use set_torrent_options with ‘max_upload_speed’
RPC exported method (Auth level: 5)
- set_torrent_move_completed(torrent_id, value)
Deprecated: Use set_torrent_options with ‘move_completed’
RPC exported method (Auth level: 5)
- set_torrent_move_completed_path(torrent_id, value)
Deprecated: Use set_torrent_options with ‘move_completed_path’
RPC exported method (Auth level: 5)
- set_torrent_options(torrent_ids, options)
Sets the torrent options for torrent_ids
- Parameters
torrent_ids (list) – A list of torrent_ids to set the options for.
options (dict) – A dict of torrent options to set. See
torrent.TorrentOptions
class for valid keys.
RPC exported method (Auth level: 5)
- set_torrent_prioritize_first_last(torrent_id, value)
Deprecated: Use set_torrent_options with ‘prioritize_first_last’
RPC exported method (Auth level: 5)
- set_torrent_remove_at_ratio(torrent_id, value)
Deprecated: Use set_torrent_options with ‘remove_at_ratio’
RPC exported method (Auth level: 5)
- set_torrent_stop_at_ratio(torrent_id, value)
Deprecated: Use set_torrent_options with ‘stop_at_ratio’
RPC exported method (Auth level: 5)
- set_torrent_stop_ratio(torrent_id, value)
Deprecated: Use set_torrent_options with ‘stop_ratio’
RPC exported method (Auth level: 5)
- set_torrent_trackers(torrent_id, trackers)
Sets a torrents tracker list. trackers will be
[{"url", "tier"}]
RPC exported method (Auth level: 5)
- test_listen_port()
Checks if the active port is open
- Returns
True if the port is open, False if not
- Return type
bool
RPC exported method (Auth level: 5)
- update_account(username, password, authlevel)
RPC exported method (Auth level: 10)
- upload_plugin(filename, filedump)
- This method is used to upload new plugins to the daemon. It is used
when connecting to the daemon remotely and installing a new plugin on the client side.
plugin_data
is axmlrpc.Binary
object of the file data, i.e.plugin_file.read()
RPC exported method (Auth level: 5)
- class deluge.core.daemon.Daemon(listen_interface=None, outgoing_interface=None, interface=None, port=None, standalone=False, read_only_config_keys=None)
The Deluge Daemon class
- __init__(listen_interface=None, outgoing_interface=None, interface=None, port=None, standalone=False, read_only_config_keys=None)
- Parameters
listen_interface (str, optional) – The IP address to listen to BitTorrent connections on.
outgoing_interface (str, optional) – The network interface name or IP address to open outgoing BitTorrent connections on.
interface (str, optional) – The IP address the daemon will listen for UI connections on.
port (int, optional) – The port the daemon will listen for UI connections on.
standalone (bool, optional) – If True the client is in Standalone mode otherwise, if False, start the daemon as separate process.
read_only_config_keys (list of str, optional) – A list of config keys that will not be altered by core.set_config() RPC method.
- authorized_call(rpc)
Determines if session auth_level is authorized to call RPC.
- Parameters
rpc (str) – A RPC, e.g. core.get_torrents_status
- Returns
bool – True if authorized to call RPC, otherwise False.
RPC exported method (Auth level: 1)
- get_method_list()
Returns a list of the exported methods.
RPC exported method (Auth level: 5)
- get_version()
Returns the daemon version
RPC exported method (Auth level: 5)
- shutdown(*args, **kwargs)
RPC exported method (Auth level: 5)