summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@gmail.com> 2014-10-12 23:31:42 +0200
committerGravatar Walter Purcaro <vuolter@gmail.com> 2014-10-12 23:31:42 +0200
commitf98477c1d4a1d4c78e4371c19ff49c3e96fee8c6 (patch)
tree1ac4b886883d9a21f46b387c92a87e9d6345660d
parent[XFileSharingPro] Match option (diff)
downloadpyload-f98477c1d4a1d4c78e4371c19ff49c3e96fee8c6.tar.xz
[DeleteFinished] Fix pluginConfigChanged
-rw-r--r--module/plugins/hooks/DeleteFinished.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/module/plugins/hooks/DeleteFinished.py b/module/plugins/hooks/DeleteFinished.py
index 2ca5bfb4a..fe808e3af 100644
--- a/module/plugins/hooks/DeleteFinished.py
+++ b/module/plugins/hooks/DeleteFinished.py
@@ -7,7 +7,7 @@ from module.plugins.Hook import Hook
class DeleteFinished(Hook):
__name__ = "DeleteFinished"
__type__ = "hook"
- __version__ = "1.09"
+ __version__ = "1.10"
__config__ = [('activated', 'bool', 'Activated', 'False'),
('interval', 'int', 'Delete every (hours)', '72'),
@@ -18,6 +18,9 @@ class DeleteFinished(Hook):
__authors__ = [("Walter Purcaro", "vuolter@gmail.com")]
+ event_list = ["pluginConfigChanged"]
+
+
## overwritten methods ##
def periodical(self):
if not self.info['sleep']:
@@ -29,30 +32,36 @@ class DeleteFinished(Hook):
self.info['sleep'] = True
self.addEvent('packageFinished', self.wakeup)
+
def pluginConfigChanged(self, plugin, name, value):
- if name == 'interval' and value != self.interval:
+ if name == "interval" and value != self.interval:
self.interval = value * 3600
self.initPeriodical()
+
def unload(self):
self.removeEvent('packageFinished', self.wakeup)
+
def coreReady(self):
self.info = {'sleep': True}
interval = self.getConfig('interval')
self.pluginConfigChanged('DeleteFinished', 'interval', interval)
self.addEvent('packageFinished', self.wakeup)
+
## own methods ##
@style.queue
def deleteFinished(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)')
+
def wakeup(self, pypack):
self.removeEvent('packageFinished', self.wakeup)
self.info['sleep'] = False
+
## event managing ##
def addEvent(self, event, func):
"""Adds an event listener for event name"""
@@ -64,6 +73,7 @@ class DeleteFinished(Hook):
else:
self.m.events[event] = [func]
+
def setup(self):
self.m = self.manager
self.removeEvent = self.m.removeEvent