summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@gmail.com> 2014-12-08 23:19:08 +0100
committerGravatar Walter Purcaro <vuolter@gmail.com> 2014-12-08 23:19:08 +0100
commit78e26bfd3b940034748256e4d0237e0ae5d33d60 (patch)
tree2b93e2fbd3d28ca2b5355c865aca1b35d660616f
parent[RestartSlow] New fixed version re-added (diff)
downloadpyload-78e26bfd3b940034748256e4d0237e0ae5d33d60.tar.xz
[SkipRev] Update (2)
-rw-r--r--module/plugins/hooks/SkipRev.py28
1 files changed, 12 insertions, 16 deletions
diff --git a/module/plugins/hooks/SkipRev.py b/module/plugins/hooks/SkipRev.py
index 76a48a255..f3edcc9dc 100644
--- a/module/plugins/hooks/SkipRev.py
+++ b/module/plugins/hooks/SkipRev.py
@@ -1,9 +1,7 @@
# -*- coding: utf-8 -*-
-import re
-
from urllib import unquote
-from urlparse import urljoin, urlparse
+from urlparse import urlparse
from module.plugins.Hook import Hook
from module.plugins.Plugin import SkipDownload
@@ -12,11 +10,9 @@ from module.plugins.Plugin import SkipDownload
class SkipRev(Hook):
__name__ = "SkipRev"
__type__ = "hook"
- __version__ = "0.13"
+ __version__ = "0.14"
- __config__ = [("auto", "bool", "Automatically keep all rev files needed by package", True),
- ("tokeep", "int" , "Min number of rev files to keep for package" , 1),
- ("unskip", "bool", "Restart a skipped rev when download fails" , True)]
+ __config__ = [("tokeep", "int", "Number of rev files to keep for package (-1 to auto)", -1)]
__description__ = """Skip files ending with extension rev"""
__license__ = "GPLv3"
@@ -55,11 +51,11 @@ class SkipRev(Hook):
tokeep = self.getConfig("tokeep")
- if tokeep > 0:
+ if tokeep:
saved = [True for link in pyfile.package().getChildren() \
if link.name.endswith(".rev") and (link.hasStatus("finished") or link.hasStatus("downloading"))].count(True)
- if saved < tokeep:
+ if not saved or saved < tokeep: #: keep one rev at least in auto mode
return
pyfile.setCustomStatus("SkipRev", "skipped")
@@ -67,15 +63,15 @@ class SkipRev(Hook):
def downloadFailed(self, pyfile):
- if self.getConfig("auto") is False:
-
- if self.getConfig("unskip") is False:
- return
+ tokeep = self.getConfig("tokeep")
- if not pyfile.name.endswith(".rev"):
- return
+ if not tokeep:
+ return
for link in pyfile.package().getChildren():
if link.hasStatus("skipped") and link.name.endswith(".rev"):
- link.setCustomStatus("unskipped", "queued")
+ if tokeep > -1 or pyfile.name.endswith(".rev"):
+ link.setStatus("queued")
+ else:
+ link.setCustomStatus("unskipped", "queued")
return