From f7e6bb7bc4fcb680aa61d68760ab5f5620552185 Mon Sep 17 00:00:00 2001 From: Vuolter Date: Fri, 17 May 2013 21:38:50 +0200 Subject: Version 0.05: several fixed according stickell advices --- module/plugins/hooks/SkipRev.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'module/plugins/hooks/SkipRev.py') diff --git a/module/plugins/hooks/SkipRev.py b/module/plugins/hooks/SkipRev.py index 4e839dc7a..9e9f1af64 100644 --- a/module/plugins/hooks/SkipRev.py +++ b/module/plugins/hooks/SkipRev.py @@ -19,10 +19,12 @@ from module.plugins.Hook import Hook from os.path import basename +from re import group, search + class SkipRev(Hook): __name__ = "SkipRev" - __version__ = "0.04" + __version__ = "0.05" __description__ = "Skip download when filename has rev extension" __config__ = [ ("activated", "bool", "Activated", "False"), @@ -34,10 +36,10 @@ class SkipRev(Hook): def downloadPreparing(self, pyfile): # self.logDebug("self.downloadPreparing") name = basename(pyfile.name) - max = self.getConfig("number") if name.endswith(".rev"): - for n in range(1, max): - if name.endswith(n + ".rev"): - return + number = self.getConfig("number") + part = search('(\.part(.+?)\.rev)*$', name).group(2) + if int(part) <= number: + return self.logInfo("Skipping " + name) pyfile.setStatus("skipped") -- cgit v1.2.3