mirror of
https://github.com/codex-storage/deluge.git
synced 2025-02-04 23:53:23 +00:00
webui:add_torrent_file_binary
This commit is contained in:
parent
616dd6288a
commit
2c12368fad
@ -173,7 +173,11 @@ $def with (exception_type, exception_value, frames, exception_message, version_i
|
||||
|
||||
|
||||
<div id="summary">
|
||||
Paste the contents of this text-box when you are asked for a traceback:<br>
|
||||
Paste the contents of this text-box when you are asked for a traceback.<br>
|
||||
Try to explain what you where doing,
|
||||
and how you could work around the problem.<br>
|
||||
Don't paste without context and expect us to know what went wrong.
|
||||
<br>
|
||||
|
||||
<!--
|
||||
<form action="http://pastebin.ca/index.php" method=POST>
|
||||
@ -199,6 +203,8 @@ $tback_txt
|
||||
|
||||
</textarea><br />
|
||||
<font color=red>Use a <a href="http://pastebin.ca/">pastebin</a> on IRC!</font><br>
|
||||
|
||||
|
||||
<!--
|
||||
<input type=submit name="Submit" value="Click here to paste to http://pastebin.ca">
|
||||
-->
|
||||
|
@ -35,7 +35,6 @@ from render import render, error_page
|
||||
import page_decorators as deco
|
||||
import lib.newforms_plus as forms
|
||||
import lib.webpy022 as web
|
||||
import base64
|
||||
|
||||
class OptionsForm(forms.Form):
|
||||
download_location = forms.ServerFolder(_("Download Location"))
|
||||
@ -120,9 +119,7 @@ class torrent_add:
|
||||
log.debug("add-url:options :%s" % options)
|
||||
utils.do_redirect()
|
||||
elif torrent_name:
|
||||
data_b64 = base64.b64encode(torrent_data)
|
||||
#b64 because of strange bug-reports related to binary data
|
||||
proxy.add_torrent_filecontent(vars.torrent.filename, data_b64, options)
|
||||
proxy.add_torrent_file_binary(vars.torrent.filename, torrent_data, options)
|
||||
log.debug("add-file:options :%s" % options)
|
||||
utils.do_redirect()
|
||||
else:
|
||||
|
@ -146,26 +146,6 @@ class Ws:
|
||||
def init_06(self, uri = 'http://localhost:58846'):
|
||||
proxy.set_core_uri(uri)
|
||||
|
||||
|
||||
#MONKEY PATCH, TODO->REMOVE!!!
|
||||
def add_torrent_filecontent(name , data_b64, options):
|
||||
log.debug('monkeypatched add_torrent_filecontent:%s,len(data:%s))' %
|
||||
(name , len(data_b64)))
|
||||
|
||||
name = name.replace('\\','/')
|
||||
name = 'deluge06_' + str(random.random()) + '_' + name.split('/')[-1]
|
||||
filename = os.path.join('/tmp', name)
|
||||
|
||||
log.debug('write: %s' % filename)
|
||||
f = open(filename,"wb")
|
||||
f.write(base64.b64decode(data_b64))
|
||||
f.close()
|
||||
log.debug("options:%s" % options)
|
||||
|
||||
log.debug("TF:%s" % proxy.add_torrent_file)
|
||||
proxy.add_torrent_file([filename] , [options])
|
||||
|
||||
proxy.add_torrent_filecontent = add_torrent_filecontent
|
||||
log.debug('cfg-file %s' % self.config_file)
|
||||
|
||||
if not os.path.exists(self.config_file):
|
||||
@ -211,6 +191,3 @@ class Ws:
|
||||
return (m.digest() == self.config.get('pwd_md5'))
|
||||
|
||||
ws =Ws()
|
||||
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user