summaryrefslogtreecommitdiffstats
path: root/module/plugins
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@gmail.com> 2014-12-24 16:48:08 +0100
committerGravatar Walter Purcaro <vuolter@gmail.com> 2014-12-24 16:48:08 +0100
commit3a7839e3c8f78c729adde099f071c31abf64ea1b (patch)
tree7dbc1deb550eacd171f86b95d4f6f0cec7508f0d /module/plugins
parent[ExtractArchive] Remove empty directory (diff)
downloadpyload-3a7839e3c8f78c729adde099f071c31abf64ea1b.tar.xz
[SkipRev] Improve downloadFailed routine
Diffstat (limited to 'module/plugins')
-rw-r--r--module/plugins/hooks/SkipRev.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/module/plugins/hooks/SkipRev.py b/module/plugins/hooks/SkipRev.py
index 1eaee0118..cc32c365e 100644
--- a/module/plugins/hooks/SkipRev.py
+++ b/module/plugins/hooks/SkipRev.py
@@ -18,7 +18,7 @@ def _setup(self):
class SkipRev(Hook):
__name__ = "SkipRev"
__type__ = "hook"
- __version__ = "0.20"
+ __version__ = "0.21"
__config__ = [("tokeep", "int", "Number of rev files to keep for package (-1 to auto)", -1)]
@@ -72,7 +72,7 @@ class SkipRev(Hook):
tokeep = self.getConfig("tokeep")
if tokeep:
- saved = [True for link in self.core.api.getPackageData(pyfile.packageid).links \
+ saved = [True for link in self.core.api.getPackageData(pyfile.package().id).links \
if link.name.endswith(".rev") and link.status in (0, 12)].count(True)
if not saved or saved < tokeep: #: keep one rev at least in auto mode
@@ -84,12 +84,17 @@ class SkipRev(Hook):
def downloadFailed(self, pyfile):
+ #: Check if pyfile is still "failed",
+ # maybe might has been restarted in meantime
+ if pyfile.status != 8:
+ return
+
tokeep = self.getConfig("tokeep")
if not tokeep:
return
- for link in self.core.api.getPackageData(pyfile.packageid).links:
+ for link in self.core.api.getPackageData(pyfile.package().id).links:
if link.status is 4 and link.name.endswith(".rev"):
pylink = self._pyfile(link)