summaryrefslogtreecommitdiffstats
path: root/module/plugins
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@gmail.com> 2013-05-31 23:15:50 +0200
committerGravatar Walter Purcaro <vuolter@gmail.com> 2013-07-07 09:06:16 +0200
commitce4658909b5bc495449451d2a83263c098c38141 (patch)
tree2486ac3e0a0699ce90e39f6d56f9c626997cecc8 /module/plugins
parentVersion 1.03: delete package even if there are offline links (diff)
downloadpyload-ce4658909b5bc495449451d2a83263c098c38141.tar.xz
Version 1.04: offline link check as option
Diffstat (limited to 'module/plugins')
-rw-r--r--module/plugins/hooks/DeleteFinished.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/module/plugins/hooks/DeleteFinished.py b/module/plugins/hooks/DeleteFinished.py
index d2882044b..59c18add7 100644
--- a/module/plugins/hooks/DeleteFinished.py
+++ b/module/plugins/hooks/DeleteFinished.py
@@ -23,11 +23,12 @@ from module.plugins.Hook import Hook
class DeleteFinished(Hook):
__name__ = "DeleteFinished"
- __version__ = "1.03"
+ __version__ = "1.04"
__description__ = "Automatically delete finished packages from queue"
__config__ = [
("activated", "bool", "Activated", "False"),
- ("interval", "int", "Delete every (hours)", "72")
+ ("interval", "int", "Delete every (hours)", "72"),
+ ("ignoreoffline", "bool", "Ignore offline link", "False")
]
__author_name__ = ("Walter Purcaro")
__author_mail__ = ("vuolter@gmail.com")
@@ -36,8 +37,9 @@ class DeleteFinished(Hook):
def periodical(self):
# self.logDebug("self.periodical")
if not self.info["sleep"]:
+ ignoreoffline = self.getConf("ignoreoffline")
self.logInfo("Delete all finished packages now")
- self.deleteFinished()
+ self.deleteFinished1() if ignoreoffline else self.deleteFinished2()
self.info["sleep"] = True
self.addEvent("packageFinished", self.wakeup)
@@ -60,10 +62,15 @@ class DeleteFinished(Hook):
## own methods ##
@style.queue
- def deleteFinished(self):
+ def deleteFinished1(self):
self.c.execute("DELETE FROM packages WHERE NOT EXISTS(SELECT 1 FROM links WHERE package=packages.id AND status NOT IN (0,1,4))")
self.c.execute("DELETE FROM links WHERE NOT EXISTS(SELECT 1 FROM packages WHERE id=links.package)")
+ @style.queue
+ def deleteFinished2(self):
+ self.c.execute("DELETE FROM packages WHERE NOT EXISTS(SELECT 1 FROM links WHERE package=packages.id AND status NOT IN (0,4))")
+ self.c.execute("DELETE FROM links WHERE NOT EXISTS(SELECT 1 FROM packages WHERE id=links.package)")
+
def wakeup(self, pypack):
# self.logDebug("self.wakeup")
self.removeEvent("packageFinished", self.wakeup)