summaryrefslogtreecommitdiffstats
path: root/module/plugins/hooks/Checksum.py
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@gmail.com> 2014-07-14 16:10:01 +0200
committerGravatar Walter Purcaro <vuolter@gmail.com> 2014-07-15 16:26:07 +0200
commit7b8c458cca7d21a029620f98e453f746fce69cd1 (patch)
tree9e97b0003a00ff8ac9ee6b777d94bb998c911d05 /module/plugins/hooks/Checksum.py
parentFix code indentation, some bad whitespaces and missing authors + use 'not' in... (diff)
downloadpyload-7b8c458cca7d21a029620f98e453f746fce69cd1.tar.xz
Prefer single quote for dict key name
Diffstat (limited to 'module/plugins/hooks/Checksum.py')
-rw-r--r--module/plugins/hooks/Checksum.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/module/plugins/hooks/Checksum.py b/module/plugins/hooks/Checksum.py
index 8566a847e..a51eb4b47 100644
--- a/module/plugins/hooks/Checksum.py
+++ b/module/plugins/hooks/Checksum.py
@@ -80,7 +80,7 @@ class Checksum(Hook):
self.algorithms = sorted(
getattr(hashlib, "algorithms", ("md5", "sha1", "sha224", "sha256", "sha384", "sha512")), reverse=True)
self.algorithms.extend(["crc32", "adler32"])
- self.formats = self.algorithms + ['sfv', 'crc', 'hash']
+ self.formats = self.algorithms + ["sfv", "crc", "hash"]
def downloadFinished(self, pyfile):
"""
@@ -158,15 +158,15 @@ class Checksum(Hook):
download_folder = save_join(self.config['general']['download_folder'], pypack.folder, "")
for link in pypack.getChildren().itervalues():
- file_type = splitext(link["name"])[1][1:].lower()
+ file_type = splitext(link['name'])[1][1:].lower()
#self.logDebug(link, file_type)
if file_type not in self.formats:
continue
- hash_file = fs_encode(save_join(download_folder, link["name"]))
+ hash_file = fs_encode(save_join(download_folder, link['name']))
if not isfile(hash_file):
- self.logWarning("File not found: %s" % link["name"])
+ self.logWarning("File not found: %s" % link['name'])
continue
with open(hash_file) as f:
@@ -174,14 +174,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.logDebug(link['name'], data)
- local_file = fs_encode(save_join(download_folder, data["name"]))
+ local_file = fs_encode(save_join(download_folder, data['name']))
algorithm = self.methods.get(file_type, file_type)
checksum = computeChecksum(local_file, algorithm)
- if checksum == data["hash"]:
+ if checksum == data['hash']:
self.logInfo('File integrity of "%s" verified by %s checksum (%s).' %
- (data["name"], algorithm, checksum))
+ (data['name'], algorithm, checksum))
else:
self.logWarning("%s checksum for file %s does not match (%s != %s)" %
- (algorithm, data["name"], checksum, data["hash"]))
+ (algorithm, data['name'], checksum, data['hash']))