diff options
author | Vuolter <vuolter@gmail.com> | 2013-05-17 21:38:50 +0200 |
---|---|---|
committer | Walter Purcaro <vuolter@gmail.com> | 2013-05-25 09:29:37 +0200 |
commit | f7e6bb7bc4fcb680aa61d68760ab5f5620552185 (patch) | |
tree | 6f1ffb355f37f7ea27d1b92931545c7697917c63 /module/plugins/hooks | |
parent | Version 0.04: forgot to import basename (diff) | |
download | pyload-f7e6bb7bc4fcb680aa61d68760ab5f5620552185.tar.xz |
Version 0.05: several fixed according stickell advices
Diffstat (limited to 'module/plugins/hooks')
-rw-r--r-- | module/plugins/hooks/SkipRev.py | 12 |
1 files changed, 7 insertions, 5 deletions
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") |