From 0e1ef9bc01579328e17e79416fa3c1c7b77adcc8 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 8 Jun 2015 06:08:01 +0200 Subject: Update everything --- module/plugins/hooks/Checksum.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hooks/Checksum.py') diff --git a/module/plugins/hooks/Checksum.py b/module/plugins/hooks/Checksum.py index ab7daf701..13374f7bd 100644 --- a/module/plugins/hooks/Checksum.py +++ b/module/plugins/hooks/Checksum.py @@ -7,7 +7,7 @@ import os import re import zlib -from module.plugins.Hook import Hook +from module.plugins.internal.Hook import Hook from module.utils import save_join, fs_encode @@ -38,7 +38,7 @@ def computeChecksum(local_file, algorithm): class Checksum(Hook): __name__ = "Checksum" __type__ = "hook" - __version__ = "0.16" + __version__ = "0.17" __config__ = [("check_checksum", "bool", "Check checksum? (If False only size will be verified)", True), ("check_action", "fail;retry;nothing", "What to do if check fails?", "retry"), -- cgit v1.2.3 From c9144f451b74e4d3cc67935b9e73c662ac870c6e Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 15 Jun 2015 07:18:39 +0200 Subject: Hook plugin code cosmetics (2) --- module/plugins/hooks/Checksum.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hooks/Checksum.py') diff --git a/module/plugins/hooks/Checksum.py b/module/plugins/hooks/Checksum.py index 13374f7bd..f132c37d1 100644 --- a/module/plugins/hooks/Checksum.py +++ b/module/plugins/hooks/Checksum.py @@ -63,7 +63,7 @@ class Checksum(Hook): 'default': r'^(?P[0-9A-Fa-f]+)\s+\*?(?P.+)$'} - def coreReady(self): + def activate(self): if not self.getConfig('check_checksum'): self.logInfo(_("Checksum validation is disabled in plugin configuration")) -- cgit v1.2.3 From 5a139055ae658d3a05cbb658cbd66aeae0d01db5 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 15 Jun 2015 21:06:10 +0200 Subject: Spare code cosmetics --- module/plugins/hooks/Checksum.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'module/plugins/hooks/Checksum.py') diff --git a/module/plugins/hooks/Checksum.py b/module/plugins/hooks/Checksum.py index f132c37d1..9287fda9c 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.Hook import Hook -from module.utils import save_join, fs_encode +from module.utils import save_join as fs_join, fs_encode def computeChecksum(local_file, algorithm): @@ -78,7 +78,7 @@ class Checksum(Hook): self.formats = self.algorithms + ["sfv", "crc", "hash"] - def downloadFinished(self, pyfile): + def download_finished(self, pyfile): """ Compute checksum for the downloaded file and compare it with the hash provided by the hoster. pyfile.plugin.check_data should be a dictionary which can contain: @@ -104,8 +104,8 @@ class Checksum(Hook): self.checkFailed(pyfile, None, "No file downloaded") local_file = fs_encode(pyfile.plugin.lastDownload) - #download_folder = self.config['general']['download_folder'] - #local_file = fs_encode(save_join(download_folder, pyfile.package().folder, pyfile.name)) + #download_folder = self.core.config['general']['download_folder'] + #local_file = fs_encode(fs_join(download_folder, pyfile.package().folder, pyfile.name)) if not os.path.isfile(local_file): self.checkFailed(pyfile, None, "File does not exist") @@ -164,8 +164,8 @@ class Checksum(Hook): pyfile.plugin.fail(reason=msg) - def packageFinished(self, pypack): - download_folder = save_join(self.config['general']['download_folder'], pypack.folder, "") + def package_finished(self, pypack): + download_folder = fs_join(self.core.config['general']['download_folder'], pypack.folder, "") for link in pypack.getChildren().itervalues(): file_type = os.path.splitext(link['name'])[1][1:].lower() @@ -173,7 +173,7 @@ class Checksum(Hook): if file_type not in self.formats: continue - hash_file = fs_encode(save_join(download_folder, link['name'])) + hash_file = fs_encode(fs_join(download_folder, link['name'])) if not os.path.isfile(hash_file): self.logWarning(_("File not found"), link['name']) continue @@ -185,7 +185,7 @@ class Checksum(Hook): data = m.groupdict() self.logDebug(link['name'], data) - local_file = fs_encode(save_join(download_folder, data['NAME'])) + local_file = fs_encode(fs_join(download_folder, data['NAME'])) algorithm = self.methods.get(file_type, file_type) checksum = computeChecksum(local_file, algorithm) if checksum == data['HASH']: -- cgit v1.2.3 From 164512b6a74c94a731fcee7435dce1ccfa2f71e7 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 17 Jun 2015 18:29:50 +0200 Subject: Spare code cosmetics --- module/plugins/hooks/Checksum.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hooks/Checksum.py') diff --git a/module/plugins/hooks/Checksum.py b/module/plugins/hooks/Checksum.py index 9287fda9c..912a1ba1f 100644 --- a/module/plugins/hooks/Checksum.py +++ b/module/plugins/hooks/Checksum.py @@ -104,7 +104,7 @@ class Checksum(Hook): self.checkFailed(pyfile, None, "No file downloaded") local_file = fs_encode(pyfile.plugin.lastDownload) - #download_folder = self.core.config['general']['download_folder'] + #download_folder = self.core.config.get("general", "download_folder") #local_file = fs_encode(fs_join(download_folder, pyfile.package().folder, pyfile.name)) if not os.path.isfile(local_file): @@ -165,7 +165,7 @@ class Checksum(Hook): def package_finished(self, pypack): - download_folder = fs_join(self.core.config['general']['download_folder'], pypack.folder, "") + download_folder = fs_join(self.core.config.get("general", "download_folder"), pypack.folder, "") for link in pypack.getChildren().itervalues(): file_type = os.path.splitext(link['name'])[1][1:].lower() -- cgit v1.2.3 From 20b6a2ec022202b0efb6cb69415239fb8f4d1445 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 17 Jun 2015 18:59:20 +0200 Subject: Spare code cosmetics (2) --- module/plugins/hooks/Checksum.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hooks/Checksum.py') diff --git a/module/plugins/hooks/Checksum.py b/module/plugins/hooks/Checksum.py index 912a1ba1f..df81be384 100644 --- a/module/plugins/hooks/Checksum.py +++ b/module/plugins/hooks/Checksum.py @@ -110,7 +110,7 @@ class Checksum(Hook): if not os.path.isfile(local_file): self.checkFailed(pyfile, None, "File does not exist") - # validate file size + #: validate file size if "size" in data: api_size = int(data['size']) file_size = os.path.getsize(local_file) @@ -121,7 +121,7 @@ class Checksum(Hook): data.pop('size', None) - # validate checksum + #: validate checksum if data and self.getConfig('check_checksum'): if not 'md5' in data: -- cgit v1.2.3 From e4fb45b22d36595839e8f638a3f0a4669dba3e8d Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 21 Jun 2015 08:50:26 +0200 Subject: Spare code cosmetics (4) --- module/plugins/hooks/Checksum.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'module/plugins/hooks/Checksum.py') diff --git a/module/plugins/hooks/Checksum.py b/module/plugins/hooks/Checksum.py index df81be384..409387c39 100644 --- a/module/plugins/hooks/Checksum.py +++ b/module/plugins/hooks/Checksum.py @@ -40,11 +40,11 @@ class Checksum(Hook): __type__ = "hook" __version__ = "0.17" - __config__ = [("check_checksum", "bool", "Check checksum? (If False only size will be verified)", True), - ("check_action", "fail;retry;nothing", "What to do if check fails?", "retry"), - ("max_tries", "int", "Number of retries", 2), - ("retry_action", "fail;nothing", "What to do if all retries fail?", "fail"), - ("wait_time", "int", "Time to wait before each retry (seconds)", 1)] + __config__ = [("check_checksum", "bool" , "Check checksum? (If False only size will be verified)", True ), + ("check_action" , "fail;retry;nothing", "What to do if check fails?" , "retry"), + ("max_tries" , "int" , "Number of retries" , 2 ), + ("retry_action" , "fail;nothing" , "What to do if all retries fail?" , "fail" ), + ("wait_time" , "int" , "Time to wait before each retry (seconds)" , 1 )] __description__ = """Verify downloaded file size and checksum""" __license__ = "GPLv3" -- cgit v1.2.3 From b1759bc440cd6013837697eb8de540914f693ffd Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 7 Jul 2015 01:23:55 +0200 Subject: No camelCase style anymore --- module/plugins/hooks/Checksum.py | 52 ++++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 26 deletions(-) (limited to 'module/plugins/hooks/Checksum.py') diff --git a/module/plugins/hooks/Checksum.py b/module/plugins/hooks/Checksum.py index 409387c39..7f42347df 100644 --- a/module/plugins/hooks/Checksum.py +++ b/module/plugins/hooks/Checksum.py @@ -11,7 +11,7 @@ from module.plugins.internal.Hook import Hook from module.utils import save_join as fs_join, fs_encode -def computeChecksum(local_file, algorithm): +def compute_checksum(local_file, algorithm): if algorithm in getattr(hashlib, "algorithms", ("md5", "sha1", "sha224", "sha256", "sha384", "sha512")): h = getattr(hashlib, algorithm)() @@ -38,7 +38,7 @@ def computeChecksum(local_file, algorithm): class Checksum(Hook): __name__ = "Checksum" __type__ = "hook" - __version__ = "0.17" + __version__ = "0.18" __config__ = [("check_checksum", "bool" , "Check checksum? (If False only size will be verified)", True ), ("check_action" , "fail;retry;nothing", "What to do if check fails?" , "retry"), @@ -64,8 +64,8 @@ class Checksum(Hook): def activate(self): - if not self.getConfig('check_checksum'): - self.logInfo(_("Checksum validation is disabled in plugin configuration")) + if not self.get_config('check_checksum'): + self.log_info(_("Checksum validation is disabled in plugin configuration")) def setup(self): @@ -98,17 +98,17 @@ class Checksum(Hook): else: return - self.logDebug(data) + self.log_debug(data) if not pyfile.plugin.lastDownload: - self.checkFailed(pyfile, None, "No file downloaded") + self.check_failed(pyfile, None, "No file downloaded") local_file = fs_encode(pyfile.plugin.lastDownload) - #download_folder = self.core.config.get("general", "download_folder") - #local_file = fs_encode(fs_join(download_folder, pyfile.package().folder, pyfile.name)) + # download_folder = self.core.config.get("general", "download_folder") + # local_file = fs_encode(fs_join(download_folder, pyfile.package().folder, pyfile.name)) if not os.path.isfile(local_file): - self.checkFailed(pyfile, None, "File does not exist") + self.check_failed(pyfile, None, "File does not exist") #: validate file size if "size" in data: @@ -116,13 +116,13 @@ class Checksum(Hook): file_size = os.path.getsize(local_file) if api_size != file_size: - self.logWarning(_("File %s has incorrect size: %d B (%d expected)") % (pyfile.name, file_size, api_size)) - self.checkFailed(pyfile, local_file, "Incorrect file size") + self.log_warning(_("File %s has incorrect size: %d B (%d expected)") % (pyfile.name, file_size, api_size)) + self.check_failed(pyfile, local_file, "Incorrect file size") data.pop('size', None) #: validate checksum - if data and self.getConfig('check_checksum'): + if data and self.get_config('check_checksum'): if not 'md5' in data: for type in ("checksum", "hashsum", "hash"): @@ -135,28 +135,28 @@ class Checksum(Hook): checksum = computeChecksum(local_file, key.replace("-", "").lower()) if checksum: if checksum == data[key].lower(): - self.logInfo(_('File integrity of "%s" verified by %s checksum (%s)') % + self.log_info(_('File integrity of "%s" verified by %s checksum (%s)') % (pyfile.name, key.upper(), checksum)) break else: - self.logWarning(_("%s checksum for file %s does not match (%s != %s)") % + self.log_warning(_("%s checksum for file %s does not match (%s != %s)") % (key.upper(), pyfile.name, checksum, data[key])) - self.checkFailed(pyfile, local_file, "Checksums do not match") + self.check_failed(pyfile, local_file, "Checksums do not match") else: - self.logWarning(_("Unsupported hashing algorithm"), key.upper()) + self.log_warning(_("Unsupported hashing algorithm"), key.upper()) else: - self.logWarning(_("Unable to validate checksum for file: ") + pyfile.name) + self.log_warning(_("Unable to validate checksum for file: ") + pyfile.name) - def checkFailed(self, pyfile, local_file, msg): - check_action = self.getConfig('check_action') + def check_failed(self, pyfile, local_file, msg): + check_action = self.get_config('check_action') if check_action == "retry": - max_tries = self.getConfig('max_tries') - retry_action = self.getConfig('retry_action') + max_tries = self.get_config('max_tries') + retry_action = self.get_config('retry_action') if pyfile.plugin.retries < max_tries: if local_file: os.remove(local_file) - pyfile.plugin.retry(max_tries, self.getConfig('wait_time'), msg) + pyfile.plugin.retry(max_tries, self.get_config('wait_time'), msg) elif retry_action == "nothing": return elif check_action == "nothing": @@ -175,7 +175,7 @@ class Checksum(Hook): hash_file = fs_encode(fs_join(download_folder, link['name'])) if not os.path.isfile(hash_file): - self.logWarning(_("File not found"), link['name']) + self.log_warning(_("File not found"), link['name']) continue with open(hash_file) as f: @@ -183,14 +183,14 @@ class Checksum(Hook): for m in re.finditer(self.regexps.get(file_type, self.regexps['default']), text): data = m.groupdict() - self.logDebug(link['name'], data) + self.log_debug(link['name'], data) local_file = fs_encode(fs_join(download_folder, data['NAME'])) algorithm = self.methods.get(file_type, file_type) checksum = computeChecksum(local_file, algorithm) if checksum == data['HASH']: - self.logInfo(_('File integrity of "%s" verified by %s checksum (%s)') % + self.log_info(_('File integrity of "%s" verified by %s checksum (%s)') % (data['NAME'], algorithm, checksum)) else: - self.logWarning(_("%s checksum for file %s does not match (%s != %s)") % + self.log_warning(_("%s checksum for file %s does not match (%s != %s)") % (algorithm, data['NAME'], checksum, data['HASH'])) -- cgit v1.2.3 From dad722ac7255640e7e0541c4094a4d2e4de79cd3 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 19 Jul 2015 00:05:58 +0200 Subject: Code cosmetics (2) --- module/plugins/hooks/Checksum.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hooks/Checksum.py') diff --git a/module/plugins/hooks/Checksum.py b/module/plugins/hooks/Checksum.py index 7f42347df..4d2dbf576 100644 --- a/module/plugins/hooks/Checksum.py +++ b/module/plugins/hooks/Checksum.py @@ -110,7 +110,7 @@ class Checksum(Hook): if not os.path.isfile(local_file): self.check_failed(pyfile, None, "File does not exist") - #: validate file size + #: Validate file size if "size" in data: api_size = int(data['size']) file_size = os.path.getsize(local_file) @@ -121,7 +121,7 @@ class Checksum(Hook): data.pop('size', None) - #: validate checksum + #: Validate checksum if data and self.get_config('check_checksum'): if not 'md5' in data: -- cgit v1.2.3 From 502517f37c7540b0bddb092e69386d9d6f08800c Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 19 Jul 2015 09:42:34 +0200 Subject: Fix addons --- module/plugins/hooks/Checksum.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'module/plugins/hooks/Checksum.py') diff --git a/module/plugins/hooks/Checksum.py b/module/plugins/hooks/Checksum.py index 4d2dbf576..681816a0f 100644 --- a/module/plugins/hooks/Checksum.py +++ b/module/plugins/hooks/Checksum.py @@ -7,7 +7,7 @@ import os import re import zlib -from module.plugins.internal.Hook import Hook +from module.plugins.internal.Addon import Addon from module.utils import save_join as fs_join, fs_encode @@ -35,7 +35,7 @@ def compute_checksum(local_file, algorithm): return None -class Checksum(Hook): +class Checksum(Addon): __name__ = "Checksum" __type__ = "hook" __version__ = "0.18" @@ -53,7 +53,6 @@ class Checksum(Hook): ("stickell" , "l.stickell@yahoo.it")] - interval = 0 #@TODO: Remove in 0.4.10 methods = {'sfv' : 'crc32', 'crc' : 'crc32', 'hash': 'md5'} @@ -68,8 +67,7 @@ class Checksum(Hook): self.log_info(_("Checksum validation is disabled in plugin configuration")) - def setup(self): - self.info = {} #@TODO: Remove in 0.4.10 + def init(self): self.algorithms = sorted( getattr(hashlib, "algorithms", ("md5", "sha1", "sha224", "sha256", "sha384", "sha512")), reverse=True) -- cgit v1.2.3 From ff9383bfe06d14d23bc0ed6af79aa8967965d078 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 19 Jul 2015 10:59:52 +0200 Subject: Code cosmetics (3) --- module/plugins/hooks/Checksum.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hooks/Checksum.py') diff --git a/module/plugins/hooks/Checksum.py b/module/plugins/hooks/Checksum.py index 681816a0f..29263a180 100644 --- a/module/plugins/hooks/Checksum.py +++ b/module/plugins/hooks/Checksum.py @@ -80,8 +80,8 @@ class Checksum(Addon): """ Compute checksum for the downloaded file and compare it with the hash provided by the hoster. pyfile.plugin.check_data should be a dictionary which can contain: - a) if known, the exact filesize in bytes (e.g. "size": 123456789) - b) hexadecimal hash string with algorithm name as key (e.g. "md5": "d76505d0869f9f928a17d42d66326307") + a) if known, the exact filesize in bytes (e.g. 'size': 123456789) + b) hexadecimal hash string with algorithm name as key (e.g. 'md5': "d76505d0869f9f928a17d42d66326307") """ if hasattr(pyfile.plugin, "check_data") and isinstance(pyfile.plugin.check_data, dict): data = pyfile.plugin.check_data.copy() -- cgit v1.2.3 From 56389e28ba5d2f5658278bc7f486d73be747f135 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 19 Jul 2015 11:44:49 +0200 Subject: Rename self.core to self.pyload (plugins only) --- module/plugins/hooks/Checksum.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hooks/Checksum.py') diff --git a/module/plugins/hooks/Checksum.py b/module/plugins/hooks/Checksum.py index 29263a180..3110f6d66 100644 --- a/module/plugins/hooks/Checksum.py +++ b/module/plugins/hooks/Checksum.py @@ -102,7 +102,7 @@ class Checksum(Addon): self.check_failed(pyfile, None, "No file downloaded") local_file = fs_encode(pyfile.plugin.lastDownload) - # download_folder = self.core.config.get("general", "download_folder") + # download_folder = self.pyload.config.get("general", "download_folder") # local_file = fs_encode(fs_join(download_folder, pyfile.package().folder, pyfile.name)) if not os.path.isfile(local_file): @@ -163,7 +163,7 @@ class Checksum(Addon): def package_finished(self, pypack): - download_folder = fs_join(self.core.config.get("general", "download_folder"), pypack.folder, "") + download_folder = fs_join(self.pyload.config.get("general", "download_folder"), pypack.folder, "") for link in pypack.getChildren().itervalues(): file_type = os.path.splitext(link['name'])[1][1:].lower() -- cgit v1.2.3 From d38e830b7c0b3c6561a0072c74bbccb5fcdf4a61 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 19 Jul 2015 14:43:42 +0200 Subject: New __status__ magic key --- module/plugins/hooks/Checksum.py | 1 + 1 file changed, 1 insertion(+) (limited to 'module/plugins/hooks/Checksum.py') diff --git a/module/plugins/hooks/Checksum.py b/module/plugins/hooks/Checksum.py index 3110f6d66..2962ec927 100644 --- a/module/plugins/hooks/Checksum.py +++ b/module/plugins/hooks/Checksum.py @@ -39,6 +39,7 @@ class Checksum(Addon): __name__ = "Checksum" __type__ = "hook" __version__ = "0.18" + __status__ = "stable" __config__ = [("check_checksum", "bool" , "Check checksum? (If False only size will be verified)", True ), ("check_action" , "fail;retry;nothing", "What to do if check fails?" , "retry"), -- cgit v1.2.3 From 94d017cd2a5c1f194960827a8c7e46afc3682008 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 24 Jul 2015 06:55:49 +0200 Subject: Hotfixes (2) --- module/plugins/hooks/Checksum.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hooks/Checksum.py') diff --git a/module/plugins/hooks/Checksum.py b/module/plugins/hooks/Checksum.py index 2962ec927..b4ccc24a1 100644 --- a/module/plugins/hooks/Checksum.py +++ b/module/plugins/hooks/Checksum.py @@ -39,7 +39,7 @@ class Checksum(Addon): __name__ = "Checksum" __type__ = "hook" __version__ = "0.18" - __status__ = "stable" + __status__ = "testing" __config__ = [("check_checksum", "bool" , "Check checksum? (If False only size will be verified)", True ), ("check_action" , "fail;retry;nothing", "What to do if check fails?" , "retry"), -- cgit v1.2.3 From 761ca5c66e07559925ebbdbc6531f9ca658b12ce Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 24 Jul 2015 16:11:58 +0200 Subject: Code cosmetics --- module/plugins/hooks/Checksum.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'module/plugins/hooks/Checksum.py') diff --git a/module/plugins/hooks/Checksum.py b/module/plugins/hooks/Checksum.py index b4ccc24a1..06cb09215 100644 --- a/module/plugins/hooks/Checksum.py +++ b/module/plugins/hooks/Checksum.py @@ -114,7 +114,7 @@ class Checksum(Addon): api_size = int(data['size']) file_size = os.path.getsize(local_file) - if api_size != file_size: + if api_size not is file_size: self.log_warning(_("File %s has incorrect size: %d B (%d expected)") % (pyfile.name, file_size, api_size)) self.check_failed(pyfile, local_file, "Incorrect file size") @@ -133,7 +133,7 @@ class Checksum(Addon): if key in data: checksum = computeChecksum(local_file, key.replace("-", "").lower()) if checksum: - if checksum == data[key].lower(): + if checksum is data[key].lower(): self.log_info(_('File integrity of "%s" verified by %s checksum (%s)') % (pyfile.name, key.upper(), checksum)) break @@ -187,7 +187,7 @@ class Checksum(Addon): local_file = fs_encode(fs_join(download_folder, data['NAME'])) algorithm = self.methods.get(file_type, file_type) checksum = computeChecksum(local_file, algorithm) - if checksum == data['HASH']: + if checksum is data['HASH']: self.log_info(_('File integrity of "%s" verified by %s checksum (%s)') % (data['NAME'], algorithm, checksum)) else: -- cgit v1.2.3 From dd13825fbd3df9e441200638cd2a92e3924dfff6 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 24 Jul 2015 23:57:04 +0200 Subject: Fix typo --- module/plugins/hooks/Checksum.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hooks/Checksum.py') diff --git a/module/plugins/hooks/Checksum.py b/module/plugins/hooks/Checksum.py index 06cb09215..9eb47e8a6 100644 --- a/module/plugins/hooks/Checksum.py +++ b/module/plugins/hooks/Checksum.py @@ -114,7 +114,7 @@ class Checksum(Addon): api_size = int(data['size']) file_size = os.path.getsize(local_file) - if api_size not is file_size: + if api_size is not file_size: self.log_warning(_("File %s has incorrect size: %d B (%d expected)") % (pyfile.name, file_size, api_size)) self.check_failed(pyfile, local_file, "Incorrect file size") -- cgit v1.2.3 From 952001324e1faf584b1adcb01c4a0406a3722932 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 25 Jul 2015 09:42:49 +0200 Subject: =?UTF-8?q?Don't=20user=20dictionary=E2=80=99s=20iterator=20method?= =?UTF-8?q?s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- module/plugins/hooks/Checksum.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hooks/Checksum.py') diff --git a/module/plugins/hooks/Checksum.py b/module/plugins/hooks/Checksum.py index 9eb47e8a6..251918df5 100644 --- a/module/plugins/hooks/Checksum.py +++ b/module/plugins/hooks/Checksum.py @@ -166,7 +166,7 @@ class Checksum(Addon): def package_finished(self, pypack): download_folder = fs_join(self.pyload.config.get("general", "download_folder"), pypack.folder, "") - for link in pypack.getChildren().itervalues(): + for link in pypack.getChildren().values(): file_type = os.path.splitext(link['name'])[1][1:].lower() if file_type not in self.formats: -- cgit v1.2.3 From 2ec703256d3565e2b34c277dcee9fb80019f2f74 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 28 Jul 2015 23:08:59 +0200 Subject: Fix https://github.com/pyload/pyload/issues/1583 --- module/plugins/hooks/Checksum.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'module/plugins/hooks/Checksum.py') diff --git a/module/plugins/hooks/Checksum.py b/module/plugins/hooks/Checksum.py index 251918df5..6ecbfcda2 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.18" + __version__ = "0.19" __status__ = "testing" __config__ = [("check_checksum", "bool" , "Check checksum? (If False only size will be verified)", True ), @@ -99,10 +99,10 @@ class Checksum(Addon): self.log_debug(data) - if not pyfile.plugin.lastDownload: + if not pyfile.plugin.last_download: self.check_failed(pyfile, None, "No file downloaded") - local_file = fs_encode(pyfile.plugin.lastDownload) + local_file = fs_encode(pyfile.plugin.last_download) # download_folder = self.pyload.config.get("general", "download_folder") # local_file = fs_encode(fs_join(download_folder, pyfile.package().folder, pyfile.name)) -- cgit v1.2.3