Add max active downloading and seeding options to scheduler.
This commit is contained in:
parent
2d821bd79a
commit
b75abc70e5
|
@ -51,6 +51,8 @@ DEFAULT_PREFS = {
|
||||||
"low_down": -1.0,
|
"low_down": -1.0,
|
||||||
"low_up": -1.0,
|
"low_up": -1.0,
|
||||||
"low_active": -1,
|
"low_active": -1,
|
||||||
|
"low_active_down": -1,
|
||||||
|
"low_active_up": -1,
|
||||||
"button_state": [[0] * 7 for dummy in xrange(24)]
|
"button_state": [[0] * 7 for dummy in xrange(24)]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,6 +79,8 @@ class Core(CorePluginBase):
|
||||||
DEFAULT_PREFS["low_down"] = core_config["max_download_speed"]
|
DEFAULT_PREFS["low_down"] = core_config["max_download_speed"]
|
||||||
DEFAULT_PREFS["low_up"] = core_config["max_upload_speed"]
|
DEFAULT_PREFS["low_up"] = core_config["max_upload_speed"]
|
||||||
DEFAULT_PREFS["low_active"] = core_config["max_active_limit"]
|
DEFAULT_PREFS["low_active"] = core_config["max_active_limit"]
|
||||||
|
DEFAULT_PREFS["low_active_down"] = core_config["max_active_downloading"]
|
||||||
|
DEFAULT_PREFS["low_active_up"] = core_config["max_active_seeding"]
|
||||||
|
|
||||||
self.config = deluge.configmanager.ConfigManager("scheduler.conf", DEFAULT_PREFS)
|
self.config = deluge.configmanager.ConfigManager("scheduler.conf", DEFAULT_PREFS)
|
||||||
|
|
||||||
|
@ -110,6 +114,8 @@ class Core(CorePluginBase):
|
||||||
core_config.apply_set_functions("max_download_speed")
|
core_config.apply_set_functions("max_download_speed")
|
||||||
core_config.apply_set_functions("max_upload_speed")
|
core_config.apply_set_functions("max_upload_speed")
|
||||||
core_config.apply_set_functions("max_active_limit")
|
core_config.apply_set_functions("max_active_limit")
|
||||||
|
core_config.apply_set_functions("max_active_downloading")
|
||||||
|
core_config.apply_set_functions("max_active_seeding")
|
||||||
# Resume the session if necessary
|
# Resume the session if necessary
|
||||||
component.get("Core").session.resume()
|
component.get("Core").session.resume()
|
||||||
|
|
||||||
|
@ -131,6 +137,8 @@ class Core(CorePluginBase):
|
||||||
session.set_upload_rate_limit(int(self.config["low_up"] * 1024))
|
session.set_upload_rate_limit(int(self.config["low_up"] * 1024))
|
||||||
settings = session.settings()
|
settings = session.settings()
|
||||||
settings.active_limit = self.config["low_active"]
|
settings.active_limit = self.config["low_active"]
|
||||||
|
settings.active_downloads = self.config["low_active_down"]
|
||||||
|
settings.active_seeds = self.config["low_active_up"]
|
||||||
session.set_settings(settings)
|
session.set_settings(settings)
|
||||||
# Resume the session if necessary
|
# Resume the session if necessary
|
||||||
component.get("Core").session.resume()
|
component.get("Core").session.resume()
|
||||||
|
|
|
@ -183,6 +183,8 @@ class GtkUI(GtkPluginBase):
|
||||||
config["low_down"] = self.spin_download.get_value()
|
config["low_down"] = self.spin_download.get_value()
|
||||||
config["low_up"] = self.spin_upload.get_value()
|
config["low_up"] = self.spin_upload.get_value()
|
||||||
config["low_active"] = self.spin_active.get_value_as_int()
|
config["low_active"] = self.spin_active.get_value_as_int()
|
||||||
|
config["low_active_down"] = self.spin_active_down.get_value_as_int()
|
||||||
|
config["low_active_up"] = self.spin_active_up.get_value_as_int()
|
||||||
config["button_state"] = self.scheduler_select.button_state
|
config["button_state"] = self.scheduler_select.button_state
|
||||||
client.scheduler.set_config(config)
|
client.scheduler.set_config(config)
|
||||||
|
|
||||||
|
@ -193,6 +195,8 @@ class GtkUI(GtkPluginBase):
|
||||||
self.spin_download.set_value(config["low_down"])
|
self.spin_download.set_value(config["low_down"])
|
||||||
self.spin_upload.set_value(config["low_up"])
|
self.spin_upload.set_value(config["low_up"])
|
||||||
self.spin_active.set_value(config["low_active"])
|
self.spin_active.set_value(config["low_active"])
|
||||||
|
self.spin_active_down.set_value(config["low_active_down"])
|
||||||
|
self.spin_active_up.set_value(config["low_active_up"])
|
||||||
|
|
||||||
|
|
||||||
client.scheduler.get_config().addCallback(on_get_config)
|
client.scheduler.get_config().addCallback(on_get_config)
|
||||||
|
@ -229,7 +233,7 @@ class GtkUI(GtkPluginBase):
|
||||||
vbox.pack_start(frame, True, True)
|
vbox.pack_start(frame, True, True)
|
||||||
vbox.pack_start(hover)
|
vbox.pack_start(hover)
|
||||||
|
|
||||||
table = gtk.Table(3, 2)
|
table = gtk.Table(3, 4)
|
||||||
|
|
||||||
label = gtk.Label(_("Download Limit:"))
|
label = gtk.Label(_("Download Limit:"))
|
||||||
label.set_alignment(0.0, 0.6)
|
label.set_alignment(0.0, 0.6)
|
||||||
|
@ -251,12 +255,30 @@ class GtkUI(GtkPluginBase):
|
||||||
|
|
||||||
label = gtk.Label(_("Active Torrents:"))
|
label = gtk.Label(_("Active Torrents:"))
|
||||||
label.set_alignment(0.0, 0.6)
|
label.set_alignment(0.0, 0.6)
|
||||||
table.attach(label, 0, 1, 2, 3, gtk.FILL)
|
table.attach(label, 2, 3, 0, 1, gtk.FILL)
|
||||||
self.spin_active = gtk.SpinButton()
|
self.spin_active = gtk.SpinButton()
|
||||||
self.spin_active.set_numeric(True)
|
self.spin_active.set_numeric(True)
|
||||||
self.spin_active.set_range(-1, 9999)
|
self.spin_active.set_range(-1, 9999)
|
||||||
self.spin_active.set_increments(1, 10)
|
self.spin_active.set_increments(1, 10)
|
||||||
table.attach(self.spin_active, 1, 2, 2, 3, gtk.FILL)
|
table.attach(self.spin_active, 3, 4, 0, 1, gtk.FILL)
|
||||||
|
|
||||||
|
label = gtk.Label(_("Active Downloading:"))
|
||||||
|
label.set_alignment(0.0, 0.6)
|
||||||
|
table.attach(label, 2, 3, 1, 2, gtk.FILL)
|
||||||
|
self.spin_active_down = gtk.SpinButton()
|
||||||
|
self.spin_active_down.set_numeric(True)
|
||||||
|
self.spin_active_down.set_range(-1, 9999)
|
||||||
|
self.spin_active_down.set_increments(1, 10)
|
||||||
|
table.attach(self.spin_active_down, 3, 4, 1, 2, gtk.FILL)
|
||||||
|
|
||||||
|
label = gtk.Label(_("Active Seeding:"))
|
||||||
|
label.set_alignment(0.0, 0.6)
|
||||||
|
table.attach(label, 2, 3, 2, 3, gtk.FILL)
|
||||||
|
self.spin_active_up = gtk.SpinButton()
|
||||||
|
self.spin_active_up.set_numeric(True)
|
||||||
|
self.spin_active_up.set_range(-1, 9999)
|
||||||
|
self.spin_active_up.set_increments(1, 10)
|
||||||
|
table.attach(self.spin_active_up, 3, 4, 2, 3, gtk.FILL)
|
||||||
|
|
||||||
eventbox = gtk.EventBox()
|
eventbox = gtk.EventBox()
|
||||||
eventbox.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse("#EDD400"))
|
eventbox.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse("#EDD400"))
|
||||||
|
|
|
@ -41,7 +41,7 @@ from setuptools import setup
|
||||||
__plugin_name__ = "Scheduler"
|
__plugin_name__ = "Scheduler"
|
||||||
__author__ = "Andrew Resch"
|
__author__ = "Andrew Resch"
|
||||||
__author_email__ = "andrewresch@gmail.com"
|
__author_email__ = "andrewresch@gmail.com"
|
||||||
__version__ = "0.1"
|
__version__ = "0.2"
|
||||||
__url__ = "http://deluge-torrent.org"
|
__url__ = "http://deluge-torrent.org"
|
||||||
__license__ = "GPLv3"
|
__license__ = "GPLv3"
|
||||||
__description__ = "Schedule limits on a per-hour per-day basis."
|
__description__ = "Schedule limits on a per-hour per-day basis."
|
||||||
|
|
Loading…
Reference in New Issue