diff options
author | Walter Purcaro <vuolter@users.noreply.github.com> | 2015-05-01 01:06:01 +0200 |
---|---|---|
committer | Walter Purcaro <vuolter@users.noreply.github.com> | 2015-05-01 01:06:01 +0200 |
commit | 1ef93e913238275f7657d496ba3d2e7eeb5a30a2 (patch) | |
tree | c52a2ab51763fce4a9b47d3c62388a27ebdeeda8 /module/plugins/hooks/Checksum.py | |
parent | Fix https://github.com/pyload/pyload/issues/1373 (diff) | |
download | pyload-1ef93e913238275f7657d496ba3d2e7eeb5a30a2.tar.xz |
Use 'import' instead 'from'
Diffstat (limited to 'module/plugins/hooks/Checksum.py')
-rw-r--r-- | module/plugins/hooks/Checksum.py | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/module/plugins/hooks/Checksum.py b/module/plugins/hooks/Checksum.py index 4ad17f55a..ab7daf701 100644 --- a/module/plugins/hooks/Checksum.py +++ b/module/plugins/hooks/Checksum.py @@ -3,12 +3,10 @@ from __future__ import with_statement import hashlib +import os import re import zlib -from os import remove -from os.path import getsize, isfile, splitext - from module.plugins.Hook import Hook from module.utils import save_join, fs_encode @@ -109,13 +107,13 @@ class Checksum(Hook): #download_folder = self.config['general']['download_folder'] #local_file = fs_encode(save_join(download_folder, pyfile.package().folder, pyfile.name)) - if not isfile(local_file): + if not os.path.isfile(local_file): self.checkFailed(pyfile, None, "File does not exist") # validate file size if "size" in data: api_size = int(data['size']) - file_size = getsize(local_file) + 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)) @@ -157,7 +155,7 @@ class Checksum(Hook): retry_action = self.getConfig('retry_action') if pyfile.plugin.retries < max_tries: if local_file: - remove(local_file) + os.remove(local_file) pyfile.plugin.retry(max_tries, self.getConfig('wait_time'), msg) elif retry_action == "nothing": return @@ -170,13 +168,13 @@ 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 = os.path.splitext(link['name'])[1][1:].lower() if file_type not in self.formats: continue hash_file = fs_encode(save_join(download_folder, link['name'])) - if not isfile(hash_file): + if not os.path.isfile(hash_file): self.logWarning(_("File not found"), link['name']) continue |