diff options
author | Walter Purcaro <vuolter@gmail.com> | 2014-09-04 22:29:59 +0200 |
---|---|---|
committer | Walter Purcaro <vuolter@gmail.com> | 2014-09-04 22:29:59 +0200 |
commit | a2b1a203a7666052d4857620b4712e82160747c2 (patch) | |
tree | d1ff91d5c4ac1e6a13f1855d9a168c6165fe2ed0 /module | |
parent | [Easybytez] distributing LINK_PATTERN (diff) | |
download | pyload-a2b1a203a7666052d4857620b4712e82160747c2.tar.xz |
[SimpleHoster] Improve parseFileInfo
Diffstat (limited to 'module')
-rw-r--r-- | module/plugins/hoster/LomafileCom.py | 7 | ||||
-rw-r--r-- | module/plugins/internal/SimpleHoster.py | 16 |
2 files changed, 12 insertions, 11 deletions
diff --git a/module/plugins/hoster/LomafileCom.py b/module/plugins/hoster/LomafileCom.py index 98b89a732..372d42fd3 100644 --- a/module/plugins/hoster/LomafileCom.py +++ b/module/plugins/hoster/LomafileCom.py @@ -8,17 +8,17 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class LomafileCom(SimpleHoster): __name__ = "LomafileCom" __type__ = "hoster" - __version__ = "0.1" + __version__ = "0.2" __pattern__ = r'https?://lomafile\.com/.+/[\w\.]+' - __description__ = """Lomafile.com hoster plugin""" + __description__ = """ Lomafile.com hoster plugin """ __author_name__ = "nath_schwarz" __author_mail__ = "nathan.notwhite@gmail.com" FILE_NAME_PATTERN = r'Filename:[^>]*>(?P<N>[\w\.]+)' FILE_SIZE_PATTERN = r'\((?P<S>\d+)\s(?P<U>\w+)\)' - FILE_OFFLINE_PATTERN = r'Software error' + OFFLINE_PATTERN = r'Software error' def handleFree(self): @@ -57,4 +57,5 @@ class LomafileCom(SimpleHoster): else: self.fail("Invalid captcha-code entered.") + getInfo = create_getInfo(LomafileCom) diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index 23b8a5292..ec9cf1b70 100644 --- a/module/plugins/internal/SimpleHoster.py +++ b/module/plugins/internal/SimpleHoster.py @@ -83,10 +83,12 @@ def parseFileInfo(self, url='', html=''): if hasattr(self, "html"): self.html = html - if (hasattr(self, "OFFLINE_PATTERN") and re.search(self.OFFLINE_PATTERN, html)) or \ - (hasattr(self, "FILE_OFFLINE_PATTERN") and re.search(self.FILE_OFFLINE_PATTERN, html)): - # File offline + if hasattr(self, "OFFLINE_PATTERN") and re.search(self.OFFLINE_PATTERN, html): info['status'] = 1 + elif hasattr(self, "FILE_OFFLINE_PATTERN") and re.search(self.FILE_OFFLINE_PATTERN, html): #@TODO: Remove in 0.4.10 + info['status'] = 1 + elif hasattr(self, "TEMP_OFFLINE_PATTERN") and re.search(self.TEMP_OFFLINE_PATTERN, html): + info['status'] = 6 else: online = False try: @@ -152,7 +154,7 @@ class PluginParseError(Exception): class SimpleHoster(Hoster): __name__ = "SimpleHoster" __type__ = "hoster" - __version__ = "0.34" + __version__ = "0.35" __pattern__ = None @@ -173,8 +175,6 @@ class SimpleHoster(Hoster): OFFLINE_PATTERN: Checks if the file is yet available online example: OFFLINE_PATTERN = r'File (deleted|not found)' - or: - FILE_OFFLINE_PATTERN: Deprecated TEMP_OFFLINE_PATTERN: Checks if the file is temporarily offline example: TEMP_OFFLINE_PATTERN = r'Server maintainance' @@ -227,13 +227,13 @@ class SimpleHoster(Hoster): def getFileInfo(self): self.logDebug("URL: %s" % self.pyfile.url) - if hasattr(self, "TEMP_OFFLINE_PATTERN") and re.search(self.TEMP_OFFLINE_PATTERN, self.html): - self.tempOffline() name, size, status = parseFileInfo(self)[:3] if status == 1: self.offline() + elif status == 6: + self.tempOffline() elif status != 2: self.logDebug(self.file_info) self.parseError('File info') |