diff options
author | Walter Purcaro <vuolter@users.noreply.github.com> | 2015-12-15 06:10:49 +0100 |
---|---|---|
committer | Walter Purcaro <vuolter@users.noreply.github.com> | 2015-12-27 22:28:33 +0100 |
commit | 8b7ae3bf93df797a2639f9359d1d3bb4ea769637 (patch) | |
tree | de4d33cd5263261293812a3518b1fd3f8e75ee87 /module/plugins/hooks | |
parent | [ExternalScripts] Update and fix (2) (diff) | |
download | pyload-8b7ae3bf93df797a2639f9359d1d3bb4ea769637.tar.xz |
[SkipRev] Fixup (1)
Diffstat (limited to 'module/plugins/hooks')
-rw-r--r-- | module/plugins/hooks/SkipRev.py | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/module/plugins/hooks/SkipRev.py b/module/plugins/hooks/SkipRev.py index 6ce1750d3..9b47c2081 100644 --- a/module/plugins/hooks/SkipRev.py +++ b/module/plugins/hooks/SkipRev.py @@ -1,9 +1,6 @@ # -*- coding: utf-8 -*- import re -import urllib - -from types import MethodType from module.PyFile import PyFile from module.plugins.internal.Addon import Addon @@ -12,7 +9,7 @@ from module.plugins.internal.Addon import Addon class SkipRev(Addon): __name__ = "SkipRev" __type__ = "hook" - __version__ = "0.35" + __version__ = "0.36" __status__ = "testing" __config__ = [("activated", "bool" , "Activated" , False ), @@ -28,7 +25,7 @@ class SkipRev(Addon): return pyfile.pluginclass.get_info(pyfile.url)['name'] - def _pyfile(self, link): + def create_pyFile(self, link): return PyFile(self.pyload.files, link.fid, link.url, @@ -47,13 +44,13 @@ class SkipRev(Addon): if pyfile.statusname is _("unskipped") or not name.endswith(".rev") or not ".part" in name: return - revtokeep = -1 if self.get_config('mode') == "Auto" else self.get_config('revtokeep') + revtokeep = -1 if self.config.get('mode') == "Auto" else self.config.get('revtokeep') 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.pyload.api.getPackageData(pyfile.package().id).links \ + queued = [True for link in pyfile.package().getChildren() \ if link.status not in status_list and pyname.match(link.name)].count(True) if not queued or queued < revtokeep: #: Keep one rev at least in auto mode @@ -63,20 +60,19 @@ class SkipRev(Addon): def download_failed(self, pyfile): - #: Check if pyfile is still "failed", maybe might has been restarted in meantime - if pyfile.status != 8 or pyfile.name.rsplit('.', 1)[-1].strip() not in ("rar", "rev"): + if pyfile.name.rsplit('.', 1)[-1].strip() not in ("rar", "rev"): return - revtokeep = -1 if self.get_config('mode') == "Auto" else self.get_config('revtokeep') + revtokeep = -1 if self.config.get('mode') == "Auto" else self.config.get('revtokeep') if not revtokeep: return pyname = re.compile(r'%s\.part\d+\.rev$' % pyfile.name.rsplit('.', 2)[0].replace('.', '\.')) - for link in self.pyload.api.getPackageData(pyfile.package().id).links: + for link in pyfile.package().getChildren(): if link.status is 4 and pyname.match(link.name): - pylink = self._pyfile(link) + pylink = self.create_pyFile(link) if revtokeep > -1 or pyfile.name.endswith(".rev"): pylink.setStatus("queued") |