Deluge Web JSON-RPC API¶
Spec: JSON-RPC v1
URL:
/json
-
class
deluge.ui.web.json_api.
WebApi
The component that implements all the methods required for managing the web interface. The complete web json interface also exposes all the methods available from the core RPC.
-
add_host
(host, port, username='', password='') Adds a host to the list.
- Parameters
host (str) – The IP or hostname of the deluge daemon.
port (int) – The port of the deluge daemon.
username (str) – The username to login to the daemon with.
password (str) – The password to login to the daemon with.
- Returns
tuple –
- A tuple of (bool, str). If True will contain the host_id, otherwise
if False will contain the error message.
-
add_torrents
(torrents) Add torrents by file
- Parameters
torrents (list) – A list of dictionaries containing the torrent path and torrent options to add with.
json_api.web.add_torrents([{ "path": "/tmp/deluge-web/some-torrent-file.torrent", "options": {"download_location": "/home/deluge/"} }])
-
connect
(host_id) Connect the web client to a daemon.
- Parameters
host_id (str) – The id of the daemon in the host list.
- Returns
Deferred – List of methods the daemon supports.
-
connected
() The current connection state.
- Returns
True if the client is connected
- Return type
booleon
-
deregister_event_listener
(event) Remove an event listener from the event queue.
- Parameters
event (string) – The event name
-
disconnect
() Disconnect the web interface from the connected daemon.
-
download_torrent_from_url
(url, cookie=None) Download a torrent file from a url to a temporary directory.
- Parameters
url (string) – the url of the torrent
- Returns
the temporary file name of the torrent file
- Return type
string
-
edit_host
(host_id, host, port, username='', password='') Edit host details in the hostlist.
- Parameters
host_id (str) – The host identifying hash.
host (str) – The IP or hostname of the deluge daemon.
port (int) – The port of the deluge daemon.
username (str) – The username to login to the daemon with.
password (str) – The password to login to the daemon with.
- Returns
bool – True if succesful, False otherwise.
-
get_config
() Get the configuration dictionary for the web interface.
- Return type
dictionary
- Returns
the configuration
-
get_events
() Retrieve the pending events for the session.
-
get_host_status
(host_id) Returns the current status for the specified host.
- Parameters
host_id (string) – the hash id of the host
-
get_hosts
() Return the hosts in the hostlist.
-
get_magnet_info
(uri) Parse a magnet URI for hash and name.
-
get_plugin_info
(name) Get the details for a plugin.
-
get_plugin_resources
(name) Get the resource data files for a plugin.
-
get_plugins
() All available and enabled plugins within WebUI.
Note
This does not represent all plugins from deluge.client.core.
- Returns
dict – A dict containing ‘available_plugins’ and ‘enabled_plugins’ lists.
-
get_torrent_files
(torrent_id) Gets the files for a torrent in tree format
- Parameters
torrent_id (string) – the id of the torrent to retrieve.
- Returns
The torrents files in a tree
- Return type
dictionary
-
get_torrent_info
(filename) Return information about a torrent on the filesystem.
- Parameters
filename (string) – the path to the torrent
- Returns
information about the torrent:
{ "name": the torrent name, "files_tree": the files the torrent contains, "info_hash" the torrents info_hash }
- Return type
dictionary
-
get_torrent_status
(torrent_id, keys) Get the status for a torrent, filtered by status keys.
-
register_event_listener
(event) Add a listener to the event queue.
- Parameters
event (string) – The event name
-
remove_host
(host_id) Removes a host from the hostlist.
- Parameters
host_id (str) – The host identifying hash.
- Returns
bool – True if succesful, False otherwise.
-
set_config
(config) Sets the configuration dictionary for the web interface.
- Parameters
config (dictionary) – The configuration options to update
-
start_daemon
(port) Starts a local daemon.
-
stop_daemon
(host_id) Stops a running daemon.
- Parameters
host_id (string) – the hash id of the host
-
update_ui
(keys, filter_dict) Gather the information required for updating the web interface.
- Parameters
keys (list) – the information about the torrents to gather
filter_dict (dictionary) – the filters to apply when selecting torrents.
- Returns
The torrent and ui information.
- Return type
dictionary
-
upload_plugin
(filename, path) Upload a plugin to config.
-
-
class
deluge.ui.web.json_api.
WebUtils
Utility functions for the webui that do not fit in the WebApi.
-
get_languages
() Get the available translated languages
- Returns
list – of tuples [(lang-id, language-name), …]
-