diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2012-06-03 15:14:28 +0200 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2012-06-03 15:14:28 +0200 |
commit | abcfb7b1b6d0af06b20d1607cbc8457537efbc3d (patch) | |
tree | 838135e95d42506b58cb44085459df4b023a966b /module/plugins | |
parent | PremiumizeMe: Added code that generates fall back file names (used for freaks... (diff) | |
parent | commit plugins only (diff) | |
download | pyload-abcfb7b1b6d0af06b20d1607cbc8457537efbc3d.tar.xz |
Merged in FloFra/pyload/stable (pull request #25)
Diffstat (limited to 'module/plugins')
-rw-r--r-- | module/plugins/hooks/Checksum.py | 12 | ||||
-rw-r--r-- | module/plugins/hooks/DownloadScheduler.py | 2 | ||||
-rw-r--r-- | module/plugins/hoster/ShareonlineBiz.py | 4 |
3 files changed, 9 insertions, 9 deletions
diff --git a/module/plugins/hooks/Checksum.py b/module/plugins/hooks/Checksum.py index 199316cd8..89e8ec762 100644 --- a/module/plugins/hooks/Checksum.py +++ b/module/plugins/hooks/Checksum.py @@ -28,7 +28,7 @@ def computeChecksum(local_file, algorithm): chunk_size = 128 * h.block_size with open(local_file, 'rb') as f: - for chunk in iter(lambda: f.read(chunk_size), b''): + for chunk in iter(lambda: f.read(chunk_size), ''): h.update(chunk) return h.hexdigest() @@ -38,7 +38,7 @@ def computeChecksum(local_file, algorithm): last = 0 with open(local_file, 'rb') as f: - for chunk in iter(lambda: f.read(8192), b''): + for chunk in iter(lambda: f.read(8192), ''): last = hf(chunk, last) return "%x" % last @@ -48,7 +48,7 @@ def computeChecksum(local_file, algorithm): class Checksum(Hook): __name__ = "Checksum" - __version__ = "0.02" + __version__ = "0.03" __description__ = "Check downloaded file hash" __config__ = [("activated", "bool", "Activated", True), ("action", "fail;retry;nothing", "What to do if check fails?", "retry"), @@ -59,16 +59,16 @@ class Checksum(Hook): def downloadFinished(self, pyfile): """ Compute checksum for the downloaded file and compare it with the hash provided by the hoster. - pyfile.plugin.file_check should be a dictionary which can contain: + 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") """ - if hasattr(pyfile.plugin, "file_check") and (isinstance(pyfile.plugin.file_check, dict)): + if hasattr(pyfile.plugin, "check_data") and (isinstance(pyfile.plugin.check_data, dict)): download_folder = self.config['general']['download_folder'] local_file = fs_encode(save_join(download_folder, pyfile.package().folder, pyfile.name)) - for key, value in sorted(pyfile.plugin.file_check.items(), reverse = True): + for key, value in sorted(pyfile.plugin.check_data.items(), reverse = True): if key == "size": if value and value != pyfile.size: self.logWarning("File %s has incorrect size: %d B (%d expected)" % (pyfile.size, value)) diff --git a/module/plugins/hooks/DownloadScheduler.py b/module/plugins/hooks/DownloadScheduler.py index 2d7d2ffb0..7cadede38 100644 --- a/module/plugins/hooks/DownloadScheduler.py +++ b/module/plugins/hooks/DownloadScheduler.py @@ -63,7 +63,7 @@ class DownloadScheduler(Hook): def setDownloadSpeed(self, speed): if speed == 0: - self.logInfo("Stopping download server. Current downloads will not be interrupted.") + self.logInfo("Stopping download server. (Running downloads will not be aborted.)") self.core.api.pauseServer() else: self.core.api.unpauseServer() diff --git a/module/plugins/hoster/ShareonlineBiz.py b/module/plugins/hoster/ShareonlineBiz.py index fbec82b7e..187ee062d 100644 --- a/module/plugins/hoster/ShareonlineBiz.py +++ b/module/plugins/hoster/ShareonlineBiz.py @@ -58,7 +58,7 @@ class ShareonlineBiz(Hoster): self.resumeDownload = self.multiDL = self.premium #self.chunkLimit = 1 - self.file_check = None + self.check_data = None def process(self, pyfile): if self.premium: @@ -77,7 +77,7 @@ class ShareonlineBiz(Hoster): self.retry(reason=_("Invalid download ticket")) if self.api_data: - self.file_check = {"size": int(self.api_data['size']), "md5": self.api_data['md5']} + self.check_data = {"size": int(self.api_data['size']), "md5": self.api_data['md5']} def downloadAPIData(self): api_url_base = "http://api.share-online.biz/linkcheck.php?md5=1" |