From dd24571c5015e3fea1877671b464104557463f6f Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 7 Oct 2014 13:52:47 +0200 Subject: [SimpleCrypter][SimpleHoster] Better exception handling --- module/plugins/internal/SimpleHoster.py | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) (limited to 'module/plugins/internal/SimpleHoster.py') diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index 6ad8398bb..238c98b05 100644 --- a/module/plugins/internal/SimpleHoster.py +++ b/module/plugins/internal/SimpleHoster.py @@ -112,9 +112,8 @@ def parseFileInfo(self, url='', html=''): self.FILE_SIZE_REPLACEMENTS) info['size'] = parseFileSize(size) elif isinstance(info['size'], basestring): - if 'units' in info: - info['size'] += info['units'] - info['size'] = parseFileSize(info['size']) + unit = info['units'] if 'units' in info else None + info['size'] = parseFileSize(info['size'], unit) if hasattr(self, "file_info"): self.file_info = info @@ -161,6 +160,7 @@ class SimpleHoster(Hoster): __author_name__ = ("zoidberg", "stickell", "Walter Purcaro") __author_mail__ = ("zoidberg@mujmail.cz", "l.stickell@yahoo.it", "vuolter@gmail.com") + """ Following patterns should be defined by each hoster: @@ -184,8 +184,11 @@ class SimpleHoster(Hoster): Instead overriding handleFree and handlePremium methods now you can define patterns for direct download: - LINK_FREE_PATTERN: (optional) Get direct link for free download - LINK_PREMIUM_PATTERN: (optional) Get direct link for premium download + LINK_FREE_PATTERN: (optional) group(1) should be the direct link for free download + example: LINK_FREE_PATTERN = r'