Opened 8 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: RushFuture Owned by: damoxc
Priority: minor Milestone: 2.1.x
Component: Web UI Version: master
Keywords: Cc:


I'm starting to develop extension for Chromium, 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, 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/ b/deluge/ui/web/
index 4febab1..e90c6ee 100644
--- a/deluge/ui/web/
+++ b/deluge/ui/web/
@@ -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
@@ -768,7 +769,7 @@ def add_torrents(self, torrents):
                 client.core.add_torrent_magnet(torrent["path"], torrent["options"])
                 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())
       "Adding torrent from file `%s` with options `%r`",
                          filename, torrent["options"])
                 client.core.add_torrent_file(filename, fdump, torrent["options"])

Change History (6)

comment:1 Changed 8 years ago by RushFuture

" must be replaced with "or", I'm sorry.

comment:2 Changed 8 years ago by Cas

  • Milestone changed from Future to 1.4.0

comment:3 Changed 4 years ago by Cas

  • Milestone changed from 2.0.x to 2.x

Milestone renamed

comment:4 Changed 4 years ago by Cas

  • Milestone changed from 2.x to 2.0

comment:5 Changed 3 years ago by Cas

  • Milestone changed from 2.0 to 2.0.0

Milestone renamed

comment:6 Changed 2 years ago by Cas

  • Milestone changed from 2.0.0 to 2.1.x

Ticket retargeted after milestone closed

Note: See TracTickets for help on using tickets.