webui sync 115

This commit is contained in:
Marcos Pinto 2007-10-29 20:01:37 +00:00
parent 054f7e5721
commit cf2c4a50f4
9 changed files with 34 additions and 27 deletions

View File

@ -28,10 +28,10 @@
# but you are not obligated to do so. If you do not wish to do so, delete # 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 # this exception statement from your version. If you delete this exception
plugin_name = _("Web User Interface") plugin_name = "Web User Interface"
plugin_author = "Martijn Voncken" plugin_author = "Martijn Voncken"
plugin_version = "rev." plugin_version = "rev."
plugin_description = _("""A Web based User Interface plugin_description = """A Web based User Interface
Firefox greasemonkey script: http://userscripts.org/scripts/show/12639 Firefox greasemonkey script: http://userscripts.org/scripts/show/12639
@ -42,7 +42,7 @@ There is support for multiple templates, but just one is included.
Other contributors: Other contributors:
*somedude : template enhancements. *somedude : template enhancements.
*markybob : stability : synced with his changes in deluge-svn. *markybob : stability : synced with his changes in deluge-svn.
""") """
import deluge.common import deluge.common
import deluge.pref import deluge.pref

View File

@ -59,16 +59,15 @@ urls = (
"/home(.*)", "home", "/home(.*)", "home",
"/about(.*)", "about", "/about(.*)", "about",
"/logout(.*)", "logout", "/logout(.*)", "logout",
#default-pages
"/", "home",
"", "home",
#remote-api: #remote-api:
"/remote/torrent/add(.*)", "remote_torrent_add", "/remote/torrent/add(.*)", "remote_torrent_add",
#static: #static:
"/static/(.*)","static", "/static/(.*)","static",
"/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
"/(.*)", "home",
"(.*)", "home"
) )
#/routing #/routing
@ -93,8 +92,8 @@ class login:
class index: class index:
"page containing the torrent list." "page containing the torrent list."
@auto_refreshed
@deluge_page @deluge_page
@auto_refreshed
def GET(self, name): def GET(self, name):
vars = web.input(sort=None, order=None) vars = web.input(sort=None, order=None)
@ -113,8 +112,8 @@ class index:
return ws.render.index(status_rows) return ws.render.index(status_rows)
class torrent_info: class torrent_info:
@auto_refreshed
@deluge_page @deluge_page
@auto_refreshed
def GET(self, torrent_id): def GET(self, torrent_id):
return ws.render.torrent_info(get_torrent_status(torrent_id)) return ws.render.torrent_info(get_torrent_status(torrent_id))

View File

@ -1 +1 @@
112 115

View File

@ -1,11 +1,13 @@
_('# Of Files') _('# Of Files')
_('About') _('About')
_('Apply')
_('Auto refresh:') _('Auto refresh:')
_('Availability') _('Availability')
_('Debug:Data Dump') _('Debug:Data Dump')
_('Delete .torrent file') _('Delete .torrent file')
_('Delete downloaded files.') _('Delete downloaded files.')
_('Details') _('Details')
_('Down Speed')
_('Downloaded') _('Downloaded')
_('ETA') _('ETA')
_('Next Announce') _('Next Announce')
@ -24,6 +26,7 @@ _('Submit')
_('Total Size') _('Total Size')
_('Tracker') _('Tracker')
_('Tracker Status') _('Tracker Status')
_('Up Speed')
_('Upload torrent') _('Upload torrent')
_('Uploaded') _('Uploaded')
_('Url') _('Url')

View File

@ -51,7 +51,7 @@ $for torrent in torrent_list:
$:render.part_button('GET', '/torrent/add', _('Add torrent'), 'tango/list-add.png') $:render.part_button('GET', '/torrent/add', _('Add torrent'), 'tango/list-add.png')
$:render.part_button('POST', '/pause_all', _('Pause all'), 'tango/media-playback-pause.png') $:render.part_button('POST', '/pause_all', _('Pause all'), 'tango/media-playback-pause.png')
$:render.part_button('POST', '/resume_all', _('Resume all'), 'tango/media-playback-start.png') $:render.part_button('POST', '/resume_all', _('Resume all'), 'tango/media-playback-start.png')
$:render.part_button('POST', '/logout', _('Logout'), 'tango/system-log-out.png') <!--$:render.part_button('POST', '/logout', _('Logout'), 'tango/system-log-out.png')-->
</div> </div>
$:part_stats() $:part_stats()

View File

@ -15,12 +15,12 @@ $#end
</div> </div>
<div class="panel" id='refresh_panel'> <div class="panel" id='refresh_panel'>
<a href='/config'> <!--<a href='/config'>-->
$_('Down Speed') : $stats.download_rate ($stats.max_download) $_('Down Speed') : $stats.download_rate ($stats.max_download)
$_('Up Speed') : $stats.upload_rate ($stats.max_upload) $_('Up Speed') : $stats.upload_rate ($stats.max_upload)
</a> <!--</a>-->
(<a href='/about'>$_('About')</a>) (<a href='/about'>$_('About')</a>)

View File

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

View File

@ -156,10 +156,10 @@ COOKIE_DEFAULTS = {
'auto_refresh_secs':'10' 'auto_refresh_secs':'10'
} }
try: #try:
SESSIONS = pickle.load(open(session_file)) # SESSIONS = pickle.load(open(session_file))
except: #except:
SESSIONS = [] SESSIONS = []

View File

@ -75,18 +75,23 @@ def setcookie(key, val):
def start_session(): def start_session():
session_id = str(random.random()) session_id = str(random.random())
ws.SESSIONS.append(session_id) ws.SESSIONS.append(session_id)
if len(ws.SESSIONS) > 20: #save max 20 sessions? #if len(ws.SESSIONS) > 20: #save max 20 sessions?
ws.SESSIONS = ws.SESSIONS[-20:] # ws.SESSIONS = ws.SESSIONS[-20:]
#not thread safe! , but a verry rare bug. #not thread safe! , but a verry rare bug.
pickle.dump(ws.SESSIONS, open(ws.session_file,'wb')) #f = open(ws.session_file,'wb')
#pickle.dump(ws.SESSIONS, f)
#f.close()
setcookie("session_id", session_id) setcookie("session_id", session_id)
def end_session(): def end_session():
session_id = getcookie("session_id") session_id = getcookie("session_id")
if session_id in ws.SESSIONS: #if session_id in ws.SESSIONS:
ws.SESSIONS.remove(session_id) # ws.SESSIONS.remove(session_id)
#not thread safe! , but a verry rare bug. #not thread safe! , but a verry rare bug.
pickle.dump(ws.SESSIONS, open(ws.session_file,'wb')) #f = open(ws.session_file,'wb')
#pickle.dump(ws.SESSIONS, f)
#f.close()
setcookie("session_id","")
def do_redirect(): def do_redirect():
"""for redirects after a POST""" """for redirects after a POST"""