summaryrefslogtreecommitdiffstats
path: root/module/plugins/hooks
diff options
context:
space:
mode:
Diffstat (limited to 'module/plugins/hooks')
-rw-r--r--module/plugins/hooks/SkipRev.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/module/plugins/hooks/SkipRev.py b/module/plugins/hooks/SkipRev.py
index a64f1a83b..feed16a2b 100644
--- a/module/plugins/hooks/SkipRev.py
+++ b/module/plugins/hooks/SkipRev.py
@@ -9,7 +9,7 @@ from module.plugins.Plugin import SkipDownload
class SkipRev(Hook):
__name__ = "SkipRev"
__type__ = "hook"
- __version__ = "0.10"
+ __version__ = "0.11"
__config__ = [("auto", "bool", "Automatically keep all rev files needed by package", True),
("tokeep", "int" , "Min number of rev files to keep for package" , 1),
@@ -20,20 +20,20 @@ class SkipRev(Hook):
__authors__ = [("Walter Purcaro", "vuolter@gmail.com")]
- event_map = [("downloadStarts", skipRev)]
+ event_list = ["downloadStarts"]
REV = re.compile(r'\.part(\d+)\.rev$')
- def skipRev(self, pyfile, url, filename):
- if REV.search(pyfile.name) is None or pyfile.getStatusName() is "unskipped":
+ def downloadStarts(self, pyfile, url, filename):
+ if self.REV.search(pyfile.name) is None or pyfile.getStatusName() is "unskipped":
return
tokeep = self.getConfig("tokeep")
if tokeep > 0:
- saved = [True if link.hasStatus("finished") or link.hasStatus("downloading") and REV.search(link.name) \
- for link in pyfile.package().getChildren()].count(True)
+ saved = [True for link in pyfile.package().getChildren() \
+ if link.hasStatus("finished") or link.hasStatus("downloading") and self.REV.search(link.name)].count(True)
if saved < tokeep:
return
@@ -47,10 +47,10 @@ class SkipRev(Hook):
if self.getConfig("unskip") is False:
return
- if REV.search(pyfile.name) is None:
+ if self.REV.search(pyfile.name) is None:
return
for link in pyfile.package().getChildren():
- if link.hasStatus("skipped") and REV.search(link.name):
+ if link.hasStatus("skipped") and self.REV.search(link.name):
link.setCustomStatus("unskipped", "queued")
return