diff options
author | Walter Purcaro <vuolter@users.noreply.github.com> | 2015-12-28 23:46:24 +0100 |
---|---|---|
committer | Walter Purcaro <vuolter@users.noreply.github.com> | 2015-12-28 23:46:24 +0100 |
commit | 58878a455067837dbe72c690606157831d3afae1 (patch) | |
tree | ac59fe8fa23a2531f7fdf03341ed1eff0326f67f /module/plugins/hooks/SkipRev.py | |
parent | Spare code fixes (2) (diff) | |
download | pyload-58878a455067837dbe72c690606157831d3afae1.tar.xz |
Spare code fixes (3)
Diffstat (limited to 'module/plugins/hooks/SkipRev.py')
-rw-r--r-- | module/plugins/hooks/SkipRev.py | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/module/plugins/hooks/SkipRev.py b/module/plugins/hooks/SkipRev.py index 9b47c2081..429737e94 100644 --- a/module/plugins/hooks/SkipRev.py +++ b/module/plugins/hooks/SkipRev.py @@ -25,17 +25,18 @@ class SkipRev(Addon): return pyfile.pluginclass.get_info(pyfile.url)['name'] - def create_pyFile(self, link): + def _create_pyFile(self, data): + pylink = self.pyload.api._convertPyFile(data) return PyFile(self.pyload.files, - link.fid, - link.url, - link.name, - link.size, - link.status, - link.error, - link.plugin, - link.packageID, - link.order) + pylink.fid, + pylink.url, + pylink.name, + pylink.size, + pylink.status, + pylink.error, + pylink.plugin, + pylink.packageID, + pylink.order) def download_preparing(self, pyfile): @@ -50,8 +51,8 @@ class SkipRev(Addon): 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 pyfile.package().getChildren() \ - if link.status not in status_list and pyname.match(link.name)].count(True) + queued = [True for fid, fdata in pyfile.package().getChildren().items() \ + if fdata['status'] not in status_list and pyname.match(fdata['name'])].count(True) if not queued or queued < revtokeep: #: Keep one rev at least in auto mode return @@ -70,15 +71,15 @@ class SkipRev(Addon): pyname = re.compile(r'%s\.part\d+\.rev$' % pyfile.name.rsplit('.', 2)[0].replace('.', '\.')) - for link in pyfile.package().getChildren(): - if link.status is 4 and pyname.match(link.name): - pylink = self.create_pyFile(link) + for fid, fdata in pyfile.package().getChildren().items(): + if fdata['status'] is 4 and pyname.match(fdata['name']): + pyfile_new = self._create_pyFile(fdata) if revtokeep > -1 or pyfile.name.endswith(".rev"): - pylink.setStatus("queued") + pyfile_new.setStatus("queued") else: - pylink.setCustomStatus(_("unskipped"), "queued") + pyfile_new.setCustomStatus(_("unskipped"), "queued") self.pyload.files.save() - pylink.release() + pyfile_new.release() return |