#2320: Directly send torrent-file content to Web UI JSON-RPC add_torrents method
------------------------+---------------------------------------------------
Reporter: RushFuture | Owner: damoxc
Type: patch | Status: new
Priority: minor | Milestone: Future
Component: webui | Version: git master
Keywords: |
------------------------+---------------------------------------------------
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"])
}}}
--
Ticket URL: <http://dev.deluge-torrent.org/ticket/2320>
Deluge <http://deluge-torrent.org/>
Deluge project
--
You received this message because you are subscribed to the Google Groups
"Deluge Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/deluge-dev?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.