webui sync 117

This commit is contained in:
Marcos Pinto 2007-10-31 03:46:36 +00:00
parent 2a9455e50a
commit 99065bf452
6 changed files with 35 additions and 21 deletions

View File

@ -134,7 +134,7 @@ class DbusManager(dbus.service.Object):
"""same as 0.6 interface""" """same as 0.6 interface"""
for torrent_id in torrents: for torrent_id in torrents:
torrent_id = int(torrent_id) torrent_id = int(torrent_id)
self.core.set_user_pause(torrent_id,True) self.core.set_user_pause(torrent_id, True)
@dbus.service.method(dbus_interface=dbus_interface, @dbus.service.method(dbus_interface=dbus_interface,
in_signature="as", out_signature="") in_signature="as", out_signature="")
@ -142,7 +142,15 @@ class DbusManager(dbus.service.Object):
"""same as 0.6 interface""" """same as 0.6 interface"""
for torrent_id in torrents: for torrent_id in torrents:
torrent_id = int(torrent_id) torrent_id = int(torrent_id)
self.core.set_user_pause(torrent_id,False) self.core.set_user_pause(torrent_id, False)
@dbus.service.method(dbus_interface=dbus_interface,
in_signature="as", out_signature="")
def force_reannounce(self, torrents):
"""same as 0.6 interface"""
for torrent_id in torrents:
torrent_id = int(torrent_id)
self.core.update_tracker(torrent_id)
@dbus.service.method(dbus_interface=dbus_interface, @dbus.service.method(dbus_interface=dbus_interface,
in_signature="sbb", out_signature="") in_signature="sbb", out_signature="")

View File

@ -47,18 +47,19 @@ urls = (
"/index(.*)", "index", "/index(.*)", "index",
"/torrent/info/(.*)", "torrent_info", "/torrent/info/(.*)", "torrent_info",
"/torrent/pause(.*)", "torrent_pause", "/torrent/pause(.*)", "torrent_pause",
"/torrent/reannounce/(.*)", "torrent_reannounce",
"/torrent/add(.*)", "torrent_add", "/torrent/add(.*)", "torrent_add",
"/torrent/delete/(.*)", "torrent_delete", "/torrent/delete/(.*)", "torrent_delete",
"/torrent/queue/up/(.*)", "torrent_queue_up", "/torrent/queue/up/(.*)", "torrent_queue_up",
"/torrent/queue/down/(.*)", "torrent_queue_down", "/torrent/queue/down/(.*)", "torrent_queue_down",
"/pause_all(.*)", "pause_all", "/pause_all", "pause_all",
"/resume_all(.*)", "resume_all", "/resume_all", "resume_all",
"/refresh/set(.*)", "refresh_set", "/refresh/set(.*)", "refresh_set",
"/refresh/(.*)", "refresh", "/refresh/(.*)", "refresh",
"/config(.*)","config", "/config","config",
"/home(.*)", "home", "/home", "home",
"/about(.*)", "about", "/about", "about",
"/logout(.*)", "logout", "/logout", "logout",
#remote-api: #remote-api:
"/remote/torrent/add(.*)", "remote_torrent_add", "/remote/torrent/add(.*)", "remote_torrent_add",
#static: #static:
@ -66,8 +67,8 @@ urls = (
"/template/static/(.*)","template_static", "/template/static/(.*)","template_static",
#"/downloads/(.*)","downloads" disabled until it can handle large downloads. #"/downloads/(.*)","downloads" disabled until it can handle large downloads.
#default-pages #default-pages
"/(.*)", "home", "/", "home",
"(.*)", "home" "", "home"
) )
#/routing #/routing
@ -125,7 +126,12 @@ class torrent_pause:
ws.proxy.pause_torrent([vars.stop]) ws.proxy.pause_torrent([vars.stop])
elif vars.start: elif vars.start:
ws.proxy.resume_torrent([vars.start]) ws.proxy.resume_torrent([vars.start])
do_redirect()
class torrent_reannounce:
@check_session
def POST(self, torrent_id):
ws.proxy.force_reannounce([torrent_id])
do_redirect() do_redirect()
class torrent_add: class torrent_add:

View File

@ -1 +1 @@
115 117

View File

@ -81,7 +81,7 @@ class="deluge_button">
</form> </form>
$:render.part_button('GET', '/torrent/delete/' + str(torrent.id), _('Remove'), 'tango/user-trash.png') $:render.part_button('GET', '/torrent/delete/' + str(torrent.id), _('Remove'), 'tango/user-trash.png')
$:render.part_button('POST', '/torrent/reannounce/' + str(torrent.id), _('Reannounce'), 'tango/view-refresh.png')
<br> <br>
<!-- <!--

View File

@ -1,5 +1,5 @@
revision-id: mvoncken@gmail.com-20070930083408-sv8mo0mi1rbjnfvk revision-id: mvoncken@gmail.com-20070930083408-sv8mo0mi1rbjnfvk
date: 2007-10-29 15:10:08 +0200 date: 2007-10-30 15:10:08 +0200
build-date: 2007-10-29 15:34:50 +0200 build-date: 2007-10-30 15:34:50 +0200
revno: 115 revno: 117
branch-nick: WebUi branch-nick: WebUi

View File

@ -136,7 +136,7 @@ def check_session(func):
a decorator a decorator
return func if session is valid, else redirect to login page. return func if session is valid, else redirect to login page.
""" """
def deco(self, name): def deco(self, name=None):
vars = web.input(redir_after_login=None) vars = web.input(redir_after_login=None)
ck = cookies() ck = cookies()
if ck.has_key("session_id") and ck["session_id"] in ws.SESSIONS: if ck.has_key("session_id") and ck["session_id"] in ws.SESSIONS:
@ -153,7 +153,7 @@ def deluge_page(func):
#combi-deco's: #combi-deco's:
def auto_refreshed(func): def auto_refreshed(func):
"decorator:adds a refresh header" "decorator:adds a refresh header"
def deco(self, name): def deco(self, name=None):
if getcookie('auto_refresh') == '1': if getcookie('auto_refresh') == '1':
web.header("Refresh", "%i ; url=%s" % web.header("Refresh", "%i ; url=%s" %
(int(getcookie('auto_refresh_secs',10)),self_url())) (int(getcookie('auto_refresh_secs',10)),self_url()))
@ -162,7 +162,7 @@ def auto_refreshed(func):
def remote(func): def remote(func):
"decorator for remote api's" "decorator for remote api's"
def deco(self, name): def deco(self, name=None):
try: try:
print func(self, name) print func(self, name)
except Exception, e: except Exception, e: