Add ability for plugins to set their component update interval by
setting a 'update_interval' value in their object.
This commit is contained in:
parent
afbca066d7
commit
b8270be10f
|
@ -37,6 +37,10 @@ import deluge.component as component
|
||||||
from deluge.log import LOG as log
|
from deluge.log import LOG as log
|
||||||
|
|
||||||
class PluginBase(component.Component):
|
class PluginBase(component.Component):
|
||||||
|
def __init__(self, name):
|
||||||
|
interval = self.update_interval if hasattr(self, update_interval) else 1
|
||||||
|
super(PluginBase, self).__init__(name, interval)
|
||||||
|
|
||||||
def enable(self):
|
def enable(self):
|
||||||
raise NotImplementedError("Need to define an enable method!")
|
raise NotImplementedError("Need to define an enable method!")
|
||||||
|
|
||||||
|
@ -45,7 +49,7 @@ class PluginBase(component.Component):
|
||||||
|
|
||||||
class CorePluginBase(PluginBase):
|
class CorePluginBase(PluginBase):
|
||||||
def __init__(self, plugin_name):
|
def __init__(self, plugin_name):
|
||||||
super(CorePluginBase, self).__init__("CorePlugin." + plugin_name)
|
super(PluginBase, self).__init__("CorePlugin." + plugin_name)
|
||||||
# Register RPC methods
|
# Register RPC methods
|
||||||
component.get("RPCServer").register_object(self, plugin_name.lower())
|
component.get("RPCServer").register_object(self, plugin_name.lower())
|
||||||
log.debug("CorePlugin initialized..")
|
log.debug("CorePlugin initialized..")
|
||||||
|
|
Loading…
Reference in New Issue