Opened 11 years ago
Last modified 2 years ago
#2320 new patch
Directly send torrent-file content to Web UI JSON-RPC add_torrents method
Reported by: | Evgeniy Nepomniashchiy | Owned by: | Damien Churchill |
---|---|---|---|
Priority: | minor | Milestone: | 2.1.1 |
Component: | Web UI | Version: | master |
Keywords: | Cc: |
Description
I'm starting to develop extension for Chromium https://github.com/RushOnline/chrome-sendlink, which will allow one-click upload torrent file to Deluge server. This is need because many trackers doesn't allow direct download torrent files. It will be awesome if WebUI JSON-RPC add_torrents method accept one more pair (named "data" in my patch) for "torrent" dictionary.
My experiments are now focused on http://rutracker.org/, but future plans include support other trackers denied direct torrent files download.
Later I'll communicate with deluge-chrome-extension author, may be he is interested to integrate the same functionality to his extension.
diff --git a/deluge/ui/web/json_api.py b/deluge/ui/web/json_api.py index 4febab1..e90c6ee 100644 --- a/deluge/ui/web/json_api.py +++ b/deluge/ui/web/json_api.py @@ -750,7 +750,8 @@ def add_torrents(self, torrents): Add torrents by file :param torrents: A list of dictionaries containing the torrent \ - path and torrent options to add with. + path, torrent data and torrent options to add with. Torrent data \ + is optional and must be encoded with base64. :type torrents: list **Usage** @@ -768,7 +769,7 @@ def add_torrents(self, torrents): client.core.add_torrent_magnet(torrent["path"], torrent["options"]) else: filename = os.path.basename(torrent["path"]) - fdump = base64.encodestring(open(torrent["path"], "rb").read()) + fdump = torrent.pop("data", None) || base64.encodestring(open(torrent["path"], "rb").read()) log.info("Adding torrent from file `%s` with options `%r`", filename, torrent["options"]) client.core.add_torrent_file(filename, fdump, torrent["options"])
Change History (8)
comment:2 by , 11 years ago
Milestone: | Future → 1.4.0 |
---|
comment:4 by , 7 years ago
Milestone: | 2.x → 2.0 |
---|