torrent-add,move,options->use component-api
This commit is contained in:
parent
f1d13d0bca
commit
13b507a925
|
@ -67,6 +67,12 @@ import pages
|
|||
import config_tabs_webui #auto registers in ConfigUiManager
|
||||
import config_tabs_deluge #auto registers in ConfigUiManager
|
||||
import register_menu
|
||||
#
|
||||
import torrent_add
|
||||
import torrent_options
|
||||
import torrent_move
|
||||
#/self registering pages.
|
||||
|
||||
|
||||
utils.set_config_defaults()
|
||||
sclient.set_core_uri(config.get('daemon'))
|
||||
|
|
|
@ -40,8 +40,6 @@ from render import render, error_page
|
|||
import time
|
||||
import page_decorators as deco
|
||||
from config_forms import config_page
|
||||
from torrent_options import torrent_options
|
||||
from torrent_move import torrent_move
|
||||
|
||||
from deluge.common import get_pixmap
|
||||
from deluge.log import LOG as log
|
||||
|
@ -49,7 +47,6 @@ from deluge.log import LOG as log
|
|||
import web
|
||||
from web import seeother, url
|
||||
from lib.static_handler import static_handler
|
||||
from torrent_add import torrent_add
|
||||
|
||||
from operator import attrgetter
|
||||
import os
|
||||
|
@ -70,13 +67,10 @@ urls = [
|
|||
"/torrent/start/(.*)", "torrent_start",
|
||||
"/torrent/reannounce/(.*)", "torrent_reannounce",
|
||||
"/torrent/recheck/(.*)", "torrent_recheck",
|
||||
"/torrent/add(.*)", "torrent_add",
|
||||
"/torrent/delete/(.*)", "torrent_delete",
|
||||
"/torrent/move/(.*)", "torrent_move",
|
||||
"/torrent/queue/up/(.*)", "torrent_queue_up",
|
||||
"/torrent/queue/down/(.*)", "torrent_queue_down",
|
||||
"/torrent/files/(.*)","torrent_files",
|
||||
"/torrent/options/(.*)","torrent_options",
|
||||
"/pause_all", "pause_all",
|
||||
"/resume_all", "resume_all",
|
||||
"/refresh/set", "refresh_set",
|
||||
|
@ -224,7 +218,7 @@ class torrent_files:
|
|||
torrent = get_torrent_status(torrent_id)
|
||||
file_priorities = web.input(file_priorities=[]).file_priorities
|
||||
#file_priorities contains something like ['0','2','3','4']
|
||||
#transform to: [1,0,0,1,1,1]
|
||||
#transform to: [1,0,1,1,1]
|
||||
proxy_prio = [0 for x in xrange(len(torrent.file_priorities))]
|
||||
for pos in file_priorities:
|
||||
proxy_prio[int(pos)] = 1
|
||||
|
@ -419,8 +413,6 @@ class pixmaps:
|
|||
web.header("Content-Length", str(fs[6]))
|
||||
web.header("Cache-Control" , "public, must-revalidate, max-age=86400")
|
||||
print content
|
||||
|
||||
|
||||
#/pages
|
||||
|
||||
page_manager.register_pages(urls,globals())
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#
|
||||
from deluge.ui.client import sclient as proxy
|
||||
from deluge.log import LOG as log
|
||||
from deluge import component
|
||||
|
||||
import utils
|
||||
from render import render, error_page
|
||||
|
@ -38,6 +39,8 @@ import page_decorators as deco
|
|||
import lib.newforms_plus as forms
|
||||
import web
|
||||
|
||||
page_manager = component.get("PageManager")
|
||||
|
||||
class OptionsForm(forms.Form):
|
||||
download_location = forms.ServerFolder(_("Download Location"))
|
||||
compact_allocation = forms.CheckBox(_("Compact Allocation"))
|
||||
|
@ -127,3 +130,5 @@ class torrent_add:
|
|||
else:
|
||||
print self.add_page(error = _("No data"))
|
||||
return
|
||||
|
||||
page_manager.register_page("/torrent/add/(.*)",torrent_add)
|
|
@ -32,12 +32,15 @@
|
|||
|
||||
from deluge.ui.client import sclient as proxy
|
||||
from deluge.log import LOG as log
|
||||
from deluge import component
|
||||
|
||||
import utils
|
||||
from render import render
|
||||
import page_decorators as deco
|
||||
import lib.newforms_plus as forms
|
||||
|
||||
page_manager = component.get("PageManager")
|
||||
|
||||
#Too much boilerplate code here, todo : fix it.
|
||||
|
||||
class MoveForm(forms.Form):
|
||||
|
@ -73,3 +76,5 @@ class torrent_move:
|
|||
save_path = form.cleaned_data["save_path"]
|
||||
proxy.move_torrent(torrent_ids, save_path)
|
||||
utils.do_redirect()
|
||||
|
||||
page_manager.register_page("/torrent/move/(.*)",torrent_move)
|
||||
|
|
|
@ -29,13 +29,18 @@
|
|||
# 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 deluge.ui.client import sclient as proxy
|
||||
from deluge.log import LOG as log
|
||||
from deluge import component
|
||||
|
||||
from render import template
|
||||
import page_decorators as deco
|
||||
import lib.newforms_plus as forms
|
||||
|
||||
class TorrentOptionsForm(forms.Form):
|
||||
page_manager = component.get("PageManager")
|
||||
|
||||
#download
|
||||
class TorrentOptionsForm(forms.Form):
|
||||
#download
|
||||
max_download_speed = forms.DelugeFloat(
|
||||
_("Maximum Down Speed"))
|
||||
max_upload_speed = forms.DelugeFloat(
|
||||
|
@ -54,3 +59,5 @@ class torrent_options:
|
|||
pass
|
||||
|
||||
template.Template.globals["forms"].torrent_options = lambda torrent : TorrentOptionsForm(torrent)
|
||||
|
||||
page_manager.register_page("/torrent/options/(.*)",torrent_options)
|
||||
|
|
Loading…
Reference in New Issue