diff options
author | Walter Purcaro <vuolter@gmail.com> | 2015-03-06 22:31:52 +0100 |
---|---|---|
committer | Walter Purcaro <vuolter@gmail.com> | 2015-03-06 22:31:52 +0100 |
commit | acc20db31c63ed03ce3e0c530a0b0bc24444e980 (patch) | |
tree | b320e802bcb62557f676b6a7a46cc69ba1bb1755 /module | |
parent | Merge pull request #1227 from jellysheep/stable (diff) | |
download | pyload-acc20db31c63ed03ce3e0c530a0b0bc24444e980.tar.xz |
[ExternalScripts] Version up
Diffstat (limited to 'module')
-rw-r--r-- | module/plugins/hooks/ExternalScripts.py | 5 | ||||
-rw-r--r-- | module/plugins/hooks/SkipRev.py | 18 |
2 files changed, 11 insertions, 12 deletions
diff --git a/module/plugins/hooks/ExternalScripts.py b/module/plugins/hooks/ExternalScripts.py index 76a9d9c52..a09d5e92e 100644 --- a/module/plugins/hooks/ExternalScripts.py +++ b/module/plugins/hooks/ExternalScripts.py @@ -10,7 +10,7 @@ from module.utils import save_join class ExternalScripts(Hook): __name__ = "ExternalScripts" __type__ = "hook" - __version__ = "0.29" + __version__ = "0.30" __config__ = [("activated", "bool", "Activated" , True ), ("wait" , "bool", "Wait script ending", False)] @@ -74,8 +74,7 @@ class ExternalScripts(Hook): def callScript(self, script, *args): try: - cmd = [script] + [x.encode("UTF-8") if isinstance(x, unicode) else - str(x) if not isinstance(x, basestring) else x for x in args] + cmd = [script] + [(str(x) if not isinstance(x, basestring) else x).encode('utf-8') for x in args] self.logDebug("Executing", os.path.abspath(script), " ".join(cmd)) diff --git a/module/plugins/hooks/SkipRev.py b/module/plugins/hooks/SkipRev.py index 034d2b803..a4d46316e 100644 --- a/module/plugins/hooks/SkipRev.py +++ b/module/plugins/hooks/SkipRev.py @@ -22,8 +22,8 @@ class SkipRev(Hook): __type__ = "hook" __version__ = "0.28" - __config__ = [("mode" , "Auto;Manual", "Choose rev files to keep for package", "Auto"), - ("tokeep", "int" , "Custom number of files to keep" , 0 )] + __config__ = [("mode" , "Auto;Manual", "Choose rev files to keep for package", "Auto"), + ("revtokeep", "int" , "Custom number of files to keep" , 0 )] __description__ = """Skip files ending with extension rev""" __license__ = "GPLv3" @@ -62,16 +62,16 @@ class SkipRev(Hook): if pyfile.statusname is "unskipped" or not name.endswith(".rev") or not ".part" in name: return - tokeep = -1 if self.getConfig('mode') == "Auto" else self.getConfig('tokeep') + revtokeep = -1 if self.getConfig('mode') == "Auto" else self.getConfig('revtokeep') - if tokeep: - status_list = (1, 4, 8, 9, 14) if tokeep < 0 else (1, 3, 4, 8, 9, 14) + if revtokeep: + status_list = (1, 4, 8, 9, 14) if revtokeep < 0 else (1, 3, 4, 8, 9, 14) pyname = re.compile(r'%s\.part\d+\.rev$' % name.rsplit('.', 2)[0].replace('.', '\.')) queued = [True for link in self.core.api.getPackageData(pyfile.package().id).links \ if link.status not in status_list and pyname.match(link.name)].count(True) - if not queued or queued < tokeep: #: keep one rev at least in auto mode + if not queued or queued < revtokeep: #: keep one rev at least in auto mode return pyfile.setCustomStatus("SkipRev", "skipped") @@ -87,9 +87,9 @@ class SkipRev(Hook): if pyfile.status != 8 or pyfile.name.rsplit('.', 1)[-1].strip() not in ("rar", "rev"): return - tokeep = -1 if self.getConfig('mode') == "Auto" else self.getConfig('tokeep') + revtokeep = -1 if self.getConfig('mode') == "Auto" else self.getConfig('revtokeep') - if not tokeep: + if not revtokeep: return pyname = re.compile(r'%s\.part\d+\.rev$' % pyfile.name.rsplit('.', 2)[0].replace('.', '\.')) @@ -98,7 +98,7 @@ class SkipRev(Hook): if link.status is 4 and pyname.match(link.name): pylink = self._pyfile(link) - if tokeep > -1 or pyfile.name.endswith(".rev"): + if revtokeep > -1 or pyfile.name.endswith(".rev"): pylink.setStatus("queued") else: pylink.setCustomStatus("unskipped", "queued") |