+$:render.footer()
\ No newline at end of file
diff --git a/deluge/ui/webui/webui_plugin/tests/multicall_notepad.py b/deluge/ui/webui/webui_plugin/tests/multicall_notepad.py
index 032633060..07a7b5066 100644
--- a/deluge/ui/webui/webui_plugin/tests/multicall_notepad.py
+++ b/deluge/ui/webui/webui_plugin/tests/multicall_notepad.py
@@ -7,82 +7,100 @@ from WebUi.webserver_common import ws
ws.init_06()
async_proxy = ws.async_proxy
-
-
-#
-#A: translate this into 1 multicall:
-
-start = time.time()
-stats = {
- 'download_rate':ws.proxy.get_download_rate(),
- 'upload_rate':ws.proxy.get_upload_rate(),
- 'max_download':ws.proxy.get_config_value('max_download_speed'),
- 'max_upload':ws.proxy.get_config_value('max_upload_speed'),
- 'num_connections':ws.proxy.get_num_connections(),
- 'max_num_connections':ws.proxy.get_config_value('max_connections_global')
-}
-
-print "sync-stats:",time.time() - start
-
-print stats
-
-#
-#map callback to a a dict-setter
-def dict_cb(key,d):
- def callback(result):
- d[key] = result
- return callback
-
-start = time.time()
-d = {}
-async_proxy.get_download_rate(dict_cb('download_rate',d))
-async_proxy.get_upload_rate(dict_cb('upload_rate',d))
-async_proxy.get_config_value(dict_cb('max_download',d),"max_download_speed")
-async_proxy.get_config_value(dict_cb('max_upload',d),"max_upload_speed")
-async_proxy.get_num_connections(dict_cb("num_connections",d))
-async_proxy.get_config_value(dict_cb('max_num_connections',d),"max_connections_global")
-
-async_proxy.force_call(block=True)
-
-print "Async-stats:",time.time() - start
-print d
-
-#
-#B: translate this to multicall:
-#
-
-#old-sync:
-start = time.time()
-
-torrent_list = [ws.proxy.get_torrent_status(id,[])
- for id in ws.proxy.get_session_state()
+TORRENT_KEYS = ['name', 'total_size', 'num_files', 'num_pieces', 'piece_length',
+ 'eta', 'ratio', 'file_progress', 'distributed_copies', 'total_done',
+ 'total_uploaded', 'state', 'paused', 'progress', 'next_announce',
+ 'total_payload_download', 'total_payload_upload', 'download_payload_rate',
+ 'upload_payload_rate', 'num_peers', 'num_seeds', 'total_peers', 'total_seeds',
+ 'total_wanted', 'tracker', 'trackers', 'tracker_status', 'save_path',
+ 'files', 'file_priorities', 'compact', 'max_connections',
+ 'max_upload_slots', 'max_download_speed', 'prioritize_first_last', 'private'
]
-print "sync-list:",time.time() - start
-print torrent_list
-
-#new async:
-
-start = time.time()
-
-torrent_ids = ws.proxy.get_session_state() #Syc-api.
-torrent_dict = {}
-for id in torrent_ids:
- async_proxy.get_torrent_status(dict_cb(id,torrent_dict), id, [])
-async_proxy.force_call(block=True)
-
-print "Async-list:",time.time() - start
-print "\n".join(torrent_dict[torrent_ids[0]].keys())
-print torrent_dict[torrent_ids[0]]["files"]
-
-
-
+if False:
+ #
+ #A: translate this into 1 multicall:
+
+ start = time.time()
+ stats = {
+ 'download_rate':ws.proxy.get_download_rate(),
+ 'upload_rate':ws.proxy.get_upload_rate(),
+ 'max_download':ws.proxy.get_config_value('max_download_speed'),
+ 'max_upload':ws.proxy.get_config_value('max_upload_speed'),
+ 'num_connections':ws.proxy.get_num_connections(),
+ 'max_num_connections':ws.proxy.get_config_value('max_connections_global')
+ }
+
+ print "sync-stats:",time.time() - start
+
+ print stats
+
+ #
+ #map callback to a a dict-setter
+ def dict_cb(key,d):
+ def callback(result):
+ d[key] = result
+ return callback
+
+ start = time.time()
+ d = {}
+ async_proxy.get_download_rate(dict_cb('download_rate',d))
+ async_proxy.get_upload_rate(dict_cb('upload_rate',d))
+ async_proxy.get_config_value(dict_cb('max_download',d),"max_download_speed")
+ async_proxy.get_config_value(dict_cb('max_upload',d),"max_upload_speed")
+ async_proxy.get_num_connections(dict_cb("num_connections",d))
+ async_proxy.get_config_value(dict_cb('max_num_connections',d),"max_connections_global")
+
+ async_proxy.force_call(block=True)
+
+ print "Async-stats:",time.time() - start
+ print d
+
+ #
+ #B: translate this to multicall:
+ #
+
+ #old-sync:
+ start = time.time()
+
+ torrent_list = [ws.proxy.get_torrent_status(id, TORRENT_KEYS )
+ for id in ws.proxy.get_session_state()
+ ]
+
+ print "sync-list:",time.time() - start
+ print torrent_list[0]
+
+ #new async:
+ """
+ torrent.compact,
+ torrent.max_connections,
+ torrent.max_upload_slots,
+ torrent.max_upload_speed,
+ torrent.max_download_speed,
+ torrent.prioritize_first_last,
+ torrent.private
+ """
+ start = time.time()
+ torrent_ids = ws.proxy.get_session_state() #Syc-api.
+ torrent_dict = {}
+ for id in torrent_ids:
+ async_proxy.get_torrent_status(dict_cb(id,torrent_dict), id, TORRENT_KEYS )
+ async_proxy.force_call(block=True)
+ print "Async-list:",time.time() - start
+ print "\n".join(torrent_dict[torrent_ids[0]].keys())
+ print torrent_dict[torrent_ids[0]]
+if False:
+ print ws.proxy.get_config_value('download_location')
+if True:
+ torrent_id = ws.proxy.get_session_state()[0]
+ print torrent_id
+ ws.proxy.move_torrent([torrent_id],"/media/sdb1/test")
\ No newline at end of file
diff --git a/deluge/ui/webui/webui_plugin/torrent_add.py b/deluge/ui/webui/webui_plugin/torrent_add.py
index 6a996ca39..e9b262b91 100644
--- a/deluge/ui/webui/webui_plugin/torrent_add.py
+++ b/deluge/ui/webui/webui_plugin/torrent_add.py
@@ -70,7 +70,12 @@ class AddForm(forms.Form):
class torrent_add:
def add_page(self,error = None):
- form_data = utils.get_newforms_data(AddForm)
+ #form_data = utils.get_newforms_data(AddForm)
+
+ #TODO: CLEANUP!!!
+ vars = web.input(url = None)
+ form_data = {'url':vars.url}
+
options_data = None
if error:
options_data = utils.get_newforms_data(OptionsForm)
diff --git a/deluge/ui/webui/webui_plugin/torrent_move.py b/deluge/ui/webui/webui_plugin/torrent_move.py
new file mode 100644
index 000000000..e6f4174c1
--- /dev/null
+++ b/deluge/ui/webui/webui_plugin/torrent_move.py
@@ -0,0 +1,74 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) Martijn Voncken 2008
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, write to:
+# The Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor
+# Boston, MA 02110-1301, USA.
+#
+# In addition, as a special exception, the copyright holders give
+# permission to link the code of portions of this program with the OpenSSL
+# library.
+# You must obey the GNU General Public License in all respects for all of
+# the code used other than OpenSSL. If you modify file(s) with this
+# exception, you may extend this exception to your version of the file(s),
+# but you are not obligated to do so. If you do not wish to do so, delete
+# this exception statement from your version. If you delete this exception
+# statement from all source files in the program, then also delete it here.
+#
+
+from webserver_common import ws
+import utils
+from render import render
+import page_decorators as deco
+import lib.newforms_plus as forms
+import lib.webpy022 as web
+
+#Too much boilerplate code here, todo : fix it.
+
+class MoveForm(forms.Form):
+ save_path = forms.ServerFolder(_("Move To"))
+ def initial_data(self):
+ return {'save_path':ws.proxy.get_config_value('download_location')}
+
+class torrent_move:
+
+ def move_page(self, name, error = None):
+ torrent_ids = name.split(',')
+ torrent_list = [utils.get_torrent_status(id) for id in torrent_ids]
+
+ data = None
+ if error:
+ data = utils.get_newforms_data(MoveForm)
+
+ form = MoveForm(data)
+
+ return render.torrent_move(name, torrent_list , form, error)
+
+ @deco.deluge_page
+ def GET(self, name):
+ return self.move_page(name)
+
+ @deco.check_session
+ def POST(self, name):
+ torrent_ids = name.split(',')
+ form = MoveForm(utils.get_newforms_data(MoveForm))
+ if not form.is_valid():
+ print self.move_page(name, error = _("Error in Path."))
+ return
+ save_path = form.clean_data["save_path"]
+ ws.proxy.move_torrent(torrent_ids, save_path)
+ utils.do_redirect()
diff --git a/deluge/ui/webui/webui_plugin/torrent_options.py b/deluge/ui/webui/webui_plugin/torrent_options.py
new file mode 100644
index 000000000..24704f791
--- /dev/null
+++ b/deluge/ui/webui/webui_plugin/torrent_options.py
@@ -0,0 +1,54 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) Martijn Voncken 2008
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, write to:
+# The Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor
+# Boston, MA 02110-1301, USA.
+#
+# In addition, as a special exception, the copyright holders give
+# permission to link the code of portions of this program with the OpenSSL
+# library.
+# You must obey the GNU General Public License in all respects for all of
+# the code used other than OpenSSL. If you modify file(s) with this
+# exception, you may extend this exception to your version of the file(s),
+# but you are not obligated to do so. If you do not wish to do so, delete
+# this exception statement from your version. If you delete this exception
+# statement from all source files in the program, then also delete it here.
+#
+from webserver_common import ws
+import utils
+from render import template
+import page_decorators as deco
+import lib.newforms_plus as forms
+import lib.webpy022 as web
+
+class TorrentOptionsForm(forms.Form):
+
+#download
+ max_download_speed = forms.DelugeFloat(
+ _("Maximum Down Speed"))
+ max_upload_speed = forms.DelugeFloat(
+ _("Maximum Up Speed"))
+ max_connections = forms.DelugeInt(_("Maximum Connections"))
+ max_upload_slots = forms.DelugeInt(_("Maximum Upload Slots"))
+ #general
+ prioritize_first_last = forms.CheckBox(
+ _('Prioritize first and last pieces'))
+ private = forms.CheckBox(_('Private Flag'))
+
+template.Template.globals["forms"].torrent_options = lambda torrent : TorrentOptionsForm(torrent)
+
diff --git a/deluge/ui/webui/webui_plugin/webserver_common.py b/deluge/ui/webui/webui_plugin/webserver_common.py
index 020224a02..c2246262e 100644
--- a/deluge/ui/webui/webui_plugin/webserver_common.py
+++ b/deluge/ui/webui/webui_plugin/webserver_common.py
@@ -64,14 +64,26 @@ try:
except:
VERSION = ''
-TORRENT_KEYS = ['distributed_copies', 'download_payload_rate',
- 'eta', 'is_seed', 'name', 'next_announce',
- 'num_files', 'num_peers', 'num_pieces', 'num_seeds', 'paused',
- 'piece_length','progress', 'ratio', 'total_done', 'total_download',
- 'total_payload_download', 'total_payload_upload', 'total_peers',
- 'total_seeds', 'total_size', 'total_upload', 'total_wanted',
- 'tracker_status', 'upload_payload_rate',
- 'uploaded_memory','tracker','state','queue_pos','user_paused','files']
+
+TORRENT_KEYS = ['name', 'total_size', 'num_files', 'num_pieces', 'piece_length',
+ 'eta', 'ratio', 'file_progress', 'distributed_copies', 'total_done',
+ 'total_uploaded', 'state', 'paused', 'progress', 'next_announce',
+ 'total_payload_download', 'total_payload_upload', 'download_payload_rate',
+ 'upload_payload_rate', 'num_peers', 'num_seeds', 'total_peers', 'total_seeds',
+ 'total_wanted', 'tracker', 'trackers', 'tracker_status', 'save_path',
+ 'files', 'file_priorities', 'compact', 'max_connections',
+ 'max_upload_slots', 'max_download_speed', 'prioritize_first_last',
+ 'private','max_upload_speed',
+
+ #REMOVE:
+ "is_seed","total_download","total_upload","uploaded_memory","queue_pos",
+ "user_paused"
+
+ ]
+"""
+NOT:is_seed,total_download,total_upload,uploaded_memory,queue_pos,user_paused
+"""
+
STATE_MESSAGES = (_("Queued"),
_("Checking"),