summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar GamaC0de <nitzo2001@yahoo.com> 2016-04-27 00:50:28 +0200
committerGravatar GamaC0de <nitzo2001@yahoo.com> 2016-04-27 00:50:28 +0200
commite8dae77e5e5bb3ce7f6fd88fa608ba2ee58ada71 (patch)
tree42bd35f5681eef7e39e5ac00ac873f7951db42d8
parent[MegaCoNz] Code cosmetics (diff)
downloadpyload-e8dae77e5e5bb3ce7f6fd88fa608ba2ee58ada71.tar.xz
[Checksum] Update
-rw-r--r--module/plugins/hooks/Checksum.py36
1 files changed, 20 insertions, 16 deletions
diff --git a/module/plugins/hooks/Checksum.py b/module/plugins/hooks/Checksum.py
index 14fca4634..9ecd79a0a 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.28"
+ __version__ = "0.29"
__status__ = "broken"
__config__ = [("activated" , "bool" , "Activated" , False ),
@@ -130,22 +130,26 @@ class Checksum(Addon):
data['hash'][key] = data[key]
break
- for key in self.algorithms:
- if key in data['hash']:
- checksum = compute_checksum(local_file, key.replace("-", "").lower())
- if checksum:
- if checksum == data['hash'][key].lower():
- self.log_info(_('File integrity of "%s" verified by %s checksum (%s)') %
- (pyfile.name, key.upper(), checksum))
- break
+ if len(data['hash']) > 0:
+ for key in self.algorithms:
+ if key in data['hash']:
+ checksum = compute_checksum(local_file, key.replace("-", "").lower())
+ if checksum:
+ if checksum == data['hash'][key].lower():
+ self.log_info(_('File integrity of "%s" verified by %s checksum (%s)') %
+ (pyfile.name, key.upper(), checksum))
+ break
+
+ else:
+ self.log_warning(_("%s checksum for file %s does not match (%s != %s)") %
+ (key.upper(), pyfile.name, checksum, data['hash'][key].lower()))
+ self.check_failed(pyfile, local_file, "Checksums do not match")
+
else:
- self.log_warning(_("%s checksum for file %s does not match (%s != %s)") %
- (key.upper(), pyfile.name, checksum, data['hash'][key].lower()))
- self.check_failed(pyfile, local_file, "Checksums do not match")
- else:
- self.log_warning(_("Unsupported hashing algorithm"), key.upper())
- else:
- self.log_warning(_("Unable to validate checksum for file: ") + pyfile.name)
+ self.log_warning(_("Unsupported hashing algorithm"), key.upper())
+
+ else:
+ self.log_warning(_('Unable to validate checksum for file: "%s"') % pyfile.name)
def check_failed(self, pyfile, local_file, msg):