diff options
author | Walter Purcaro <vuolter@users.noreply.github.com> | 2015-12-28 16:04:35 +0100 |
---|---|---|
committer | Walter Purcaro <vuolter@users.noreply.github.com> | 2015-12-28 16:04:35 +0100 |
commit | 58a00607a64cc26820c8a995f5f7863e2465911d (patch) | |
tree | 8d25c0afe8b1115b00ffdc5cda036fb95063ea16 /module/plugins/hooks/Checksum.py | |
parent | Spare code fixes (diff) | |
download | pyload-58a00607a64cc26820c8a995f5f7863e2465911d.tar.xz |
Spare code fixes (2)
Diffstat (limited to 'module/plugins/hooks/Checksum.py')
-rw-r--r-- | module/plugins/hooks/Checksum.py | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/module/plugins/hooks/Checksum.py b/module/plugins/hooks/Checksum.py index cf5ed2147..28fdeafee 100644 --- a/module/plugins/hooks/Checksum.py +++ b/module/plugins/hooks/Checksum.py @@ -8,7 +8,7 @@ import re import zlib from module.plugins.internal.Addon import Addon -from module.plugins.internal.utils import encode, fs_join +from module.plugins.internal.misc import encode, fsjoin def compute_checksum(local_file, algorithm): @@ -38,7 +38,7 @@ def compute_checksum(local_file, algorithm): class Checksum(Addon): __name__ = "Checksum" __type__ = "hook" - __version__ = "0.23" + __version__ = "0.24" __status__ = "testing" __config__ = [("activated" , "bool" , "Activated" , False ), @@ -65,7 +65,7 @@ class Checksum(Addon): def activate(self): - if not self.get_config('check_checksum'): + if not self.config.get('check_checksum'): self.log_info(_("Checksum validation is disabled in plugin configuration")) @@ -105,7 +105,7 @@ class Checksum(Addon): local_file = encode(pyfile.plugin.last_download) # dl_folder = self.pyload.config.get("general", "download_folder") - # local_file = encode(fs_join(dl_folder, pyfile.package().folder, pyfile.name)) + # local_file = encode(fsjoin(dl_folder, pyfile.package().folder, pyfile.name)) if not os.path.isfile(local_file): self.check_failed(pyfile, None, "File does not exist") @@ -122,7 +122,7 @@ class Checksum(Addon): data.pop('size', None) #: Validate checksum - if data and self.get_config('check_checksum'): + if data and self.config.get('check_checksum'): if not 'md5' in data: for type in ("checksum", "hashsum", "hash"): @@ -149,14 +149,14 @@ class Checksum(Addon): def check_failed(self, pyfile, local_file, msg): - check_action = self.get_config('check_action') + check_action = self.config.get('check_action') if check_action == "retry": - max_tries = self.get_config('max_tries') - retry_action = self.get_config('retry_action') + max_tries = self.config.get('max_tries') + retry_action = self.config.get('retry_action') if pyfile.plugin.retries < max_tries: if local_file: os.remove(local_file) - pyfile.plugin.retry(max_tries, self.get_config('wait_time'), msg) + pyfile.plugin.retry(max_tries, self.config.get('wait_time'), msg) elif retry_action == "nothing": return elif check_action == "nothing": @@ -166,7 +166,7 @@ class Checksum(Addon): def package_finished(self, pypack): - dl_folder = fs_join(self.pyload.config.get("general", "download_folder"), pypack.folder, "") + dl_folder = fsjoin(self.pyload.config.get("general", "download_folder"), pypack.folder, "") for link in pypack.getChildren().values(): file_type = os.path.splitext(link['name'])[1][1:].lower() @@ -174,7 +174,7 @@ class Checksum(Addon): if file_type not in self.formats: continue - hash_file = encode(fs_join(dl_folder, link['name'])) + hash_file = encode(fsjoin(dl_folder, link['name'])) if not os.path.isfile(hash_file): self.log_warning(_("File not found"), link['name']) continue @@ -186,7 +186,7 @@ class Checksum(Addon): data = m.groupdict() self.log_debug(link['name'], data) - local_file = encode(fs_join(dl_folder, data['NAME'])) + local_file = encode(fsjoin(dl_folder, data['NAME'])) algorithm = self.methods.get(file_type, file_type) checksum = compute_checksum(local_file, algorithm) |