diff options
author | Walter Purcaro <vuolter@users.noreply.github.com> | 2015-09-21 01:08:35 +0200 |
---|---|---|
committer | Walter Purcaro <vuolter@users.noreply.github.com> | 2015-09-21 01:08:35 +0200 |
commit | 59d2ad3541bf133ddd69fd3b7c633e7e226e4829 (patch) | |
tree | 4fffa227d1acc13190382b0b059f8cd99824ae12 /module/plugins/hooks | |
parent | [Account] parse_info -> grab_info (diff) | |
download | pyload-59d2ad3541bf133ddd69fd3b7c633e7e226e4829.tar.xz |
Spare improvements and fixes
Diffstat (limited to 'module/plugins/hooks')
-rw-r--r-- | module/plugins/hooks/Checksum.py | 4 | ||||
-rw-r--r-- | module/plugins/hooks/ExtractArchive.py | 42 | ||||
-rw-r--r-- | module/plugins/hooks/SkipRev.py | 14 | ||||
-rw-r--r-- | module/plugins/hooks/TransmissionRPC.py | 2 |
4 files changed, 23 insertions, 39 deletions
diff --git a/module/plugins/hooks/Checksum.py b/module/plugins/hooks/Checksum.py index 64c5fa3ff..2a650768e 100644 --- a/module/plugins/hooks/Checksum.py +++ b/module/plugins/hooks/Checksum.py @@ -38,7 +38,7 @@ def compute_checksum(local_file, algorithm): class Checksum(Addon): __name__ = "Checksum" __type__ = "hook" - __version__ = "0.21" + __version__ = "0.22" __status__ = "testing" __config__ = [("check_checksum", "bool" , "Check checksum? (If False only size will be verified)", True ), @@ -160,7 +160,7 @@ class Checksum(Addon): return elif check_action == "nothing": return - pyfile.plugin.fail(reason=msg) + pyfile.plugin.fail(msg=msg) def package_finished(self, pypack): diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py index 87cd38ade..469f73141 100644 --- a/module/plugins/hooks/ExtractArchive.py +++ b/module/plugins/hooks/ExtractArchive.py @@ -107,7 +107,7 @@ class ArchiveQueue(object): class ExtractArchive(Addon): __name__ = "ExtractArchive" __type__ = "hook" - __version__ = "1.50" + __version__ = "1.51" __status__ = "testing" __config__ = [("activated" , "bool" , "Activated" , True ), @@ -115,7 +115,6 @@ class ExtractArchive(Addon): ("overwrite" , "bool" , "Overwrite files" , False ), ("keepbroken" , "bool" , "Try to extract broken archives" , False ), ("repair" , "bool" , "Repair broken archives (RAR required)" , False ), - ("test" , "bool" , "Test archive before extracting" , False ), ("usepasswordfile", "bool" , "Use password file" , True ), ("passwordfile" , "file" , "Password file" , "passwords.txt" ), ("delete" , "bool" , "Delete archive after extraction" , True ), @@ -348,7 +347,7 @@ class ExtractArchive(Addon): #: Remove processed file and related multiparts from list files_ids = [(fname, fid, fout) for fname, fid, fout in files_ids \ - if fname not in archive.get_delete_files()] + if fname not in archive.items()] self.log_debug("Extracted files: %s" % new_files) for file in new_files: @@ -403,18 +402,10 @@ class ExtractArchive(Addon): passwords = uniqify([password] + self.get_passwords(False)) if self.get_config('usepasswordfile') else [password] for pw in passwords: try: - if self.get_config('test') or self.repair: - pyfile.setCustomStatus(_("archive testing")) - if pw: - self.log_debug("Testing with password: %s" % pw) - pyfile.setProgress(0) - archive.verify(pw) - pyfile.setProgress(100) - else: - archive.check(pw) - - self.add_password(pw) - break + pyfile.setCustomStatus(_("archive testing")) + pyfile.setProgress(0) + archive.verify(pw) + pyfile.setProgress(100) except PasswordError: if not encrypted: @@ -425,9 +416,11 @@ class ExtractArchive(Addon): self.log_debug(name, e) self.log_info(name, _("CRC Error")) - if self.repair: - self.log_warning(name, _("Repairing...")) + if not self.repair: + raise CRCError("Archive damaged") + else: + self.log_warning(name, _("Repairing...")) pyfile.setCustomStatus(_("archive repairing")) pyfile.setProgress(0) repaired = archive.repair() @@ -436,15 +429,18 @@ class ExtractArchive(Addon): if not repaired and not self.get_config('keepbroken'): raise CRCError("Archive damaged") - self.add_password(pw) - break - - raise CRCError("Archive damaged") + else: + self.add_password(pw) + break except ArchiveError, e: raise ArchiveError(e) - pyfile.setCustomStatus(_("extracting")) + else: + self.add_password(pw) + break + + pyfile.setCustomStatus(_("archive extracting")) pyfile.setProgress(0) if not encrypted or not self.get_config('usepasswordfile'): @@ -467,7 +463,7 @@ class ExtractArchive(Addon): pyfile.setProgress(100) pyfile.setStatus("processing") - delfiles = archive.get_delete_files() + delfiles = archive.items() self.log_debug("Would delete: " + ", ".join(delfiles)) if self.get_config('delete'): diff --git a/module/plugins/hooks/SkipRev.py b/module/plugins/hooks/SkipRev.py index a1ddc3094..9f54218d6 100644 --- a/module/plugins/hooks/SkipRev.py +++ b/module/plugins/hooks/SkipRev.py @@ -13,7 +13,7 @@ from module.plugins.internal.Addon import Addon class SkipRev(Addon): __name__ = "SkipRev" __type__ = "hook" - __version__ = "0.33" + __version__ = "0.34" __status__ = "testing" __config__ = [("mode" , "Auto;Manual", "Choose recovery archives to skip" , "Auto"), @@ -24,13 +24,6 @@ class SkipRev(Addon): __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - @staticmethod - def _init(self): - self.pyfile.plugin._init() - if self.pyfile.hasStatus("skipped"): - self.skip(self.pyfile.statusname or self.pyfile.pluginname) - - def _name(self, pyfile): return pyfile.pluginclass.get_info(pyfile.url)['name'] @@ -68,11 +61,6 @@ class SkipRev(Addon): pyfile.setCustomStatus("SkipRev", "skipped") - if not hasattr(pyfile.plugin, "_init"): - #: Work-around: inject status checker inside the preprocessing routine of the plugin - pyfile.plugin._init = pyfile.plugin.init - pyfile.plugin.init = MethodType(self._init, pyfile.plugin) - def download_failed(self, pyfile): #: Check if pyfile is still "failed", maybe might has been restarted in meantime diff --git a/module/plugins/hooks/TransmissionRPC.py b/module/plugins/hooks/TransmissionRPC.py index 2ca06a9ad..715f82edb 100644 --- a/module/plugins/hooks/TransmissionRPC.py +++ b/module/plugins/hooks/TransmissionRPC.py @@ -66,7 +66,7 @@ class TransmissionRPC(Addon): except Exception, e: self.log_error(e) return - + else: self.log_error(e) return |