summaryrefslogtreecommitdiffstats
path: root/module/plugins/hooks/DeleteFinished.py
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-07-07 01:23:55 +0200
committerGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-07-07 01:23:55 +0200
commitb1759bc440cd6013837697eb8de540914f693ffd (patch)
treed170caf63d7f65e44d23ea2d91a65759a1665928 /module/plugins/hooks/DeleteFinished.py
parent[Plugin] Fix decoding in load method (diff)
downloadpyload-b1759bc440cd6013837697eb8de540914f693ffd.tar.xz
No camelCase style anymore
Diffstat (limited to 'module/plugins/hooks/DeleteFinished.py')
-rw-r--r--module/plugins/hooks/DeleteFinished.py34
1 files changed, 17 insertions, 17 deletions
diff --git a/module/plugins/hooks/DeleteFinished.py b/module/plugins/hooks/DeleteFinished.py
index a65e61547..ec708eb10 100644
--- a/module/plugins/hooks/DeleteFinished.py
+++ b/module/plugins/hooks/DeleteFinished.py
@@ -7,7 +7,7 @@ from module.plugins.internal.Hook import Hook
class DeleteFinished(Hook):
__name__ = "DeleteFinished"
__type__ = "hook"
- __version__ = "1.13"
+ __version__ = "1.14"
__config__ = [("interval" , "int" , "Check interval in hours" , 72 ),
("deloffline", "bool", "Delete package with offline links", False)]
@@ -23,25 +23,25 @@ class DeleteFinished(Hook):
## overwritten methods ##
def setup(self):
self.info = {} #@TODO: Remove in 0.4.10
- #: self.event_list = ["pluginConfigChanged"]
+ # self.event_map = {'pluginConfigChanged': "plugin_config_changed"}
self.interval = self.MIN_CHECK_INTERVAL
def periodical(self):
if not self.info['sleep']:
- deloffline = self.getConfig('deloffline')
+ deloffline = self.get_config('deloffline')
mode = "0,1,4" if deloffline else "0,4"
msg = _('delete all finished packages in queue list (%s packages with offline links)')
- self.logInfo(msg % (_('including') if deloffline else _('excluding')))
- self.deleteFinished(mode)
+ self.log_info(msg % (_('including') if deloffline else _('excluding')))
+ self.delete_finished(mode)
self.info['sleep'] = True
- self.addEvent('package_finished', self.wakeup)
+ self.add_event('package_finished', self.wakeup)
- #: def pluginConfigChanged(self, plugin, name, value):
- #: if name == "interval" and value != self.interval:
- #: self.interval = value * 3600
- #: self.init_periodical()
+ # def plugin_config_changed(self, plugin, name, value):
+ # if name == "interval" and value != self.interval:
+ # self.interval = value * 3600
+ # self.init_periodical()
def deactivate(self):
@@ -50,15 +50,15 @@ class DeleteFinished(Hook):
def activate(self):
self.info['sleep'] = True
- #: interval = self.getConfig('interval')
- #: self.pluginConfigChanged(self.__name__, 'interval', interval)
- self.interval = max(self.MIN_CHECK_INTERVAL, self.getConfig('interval') * 60 * 60)
- self.addEvent('package_finished', self.wakeup)
+ #: interval = self.get_config('interval')
+ #: self.plugin_config_changed(self.__name__, 'interval', interval)
+ self.interval = max(self.MIN_CHECK_INTERVAL, self.get_config('interval') * 60 * 60)
+ self.add_event('package_finished', self.wakeup)
## own methods ##
@style.queue
- def deleteFinished(self, mode):
+ def delete_finished(self, mode):
self.c.execute('DELETE FROM packages WHERE NOT EXISTS(SELECT 1 FROM links WHERE package=packages.id AND status NOT IN (%s))' % mode)
self.c.execute('DELETE FROM links WHERE NOT EXISTS(SELECT 1 FROM packages WHERE id=links.package)')
@@ -69,13 +69,13 @@ class DeleteFinished(Hook):
## event managing ##
- def addEvent(self, event, func):
+ def add_event(self, event, func):
"""
Adds an event listener for event name
"""
if event in self.manager.events:
if func in self.manager.events[event]:
- self.logDebug("Function already registered", func)
+ self.log_debug("Function already registered", func)
else:
self.manager.events[event].append(func)
else: