From 93592862b520a862c01f80c019e5c4bc43746c19 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 5 Jul 2014 16:54:20 +0200 Subject: [SimpleHoster] Better inline docs + changed "FILE_OFFLINE_PATTERN" to "OFFLINE_PATTERN" --- module/plugins/internal/SimpleHoster.py | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) (limited to 'module/plugins/internal/SimpleHoster.py') diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index 8c2e3daae..b5066437e 100644 --- a/module/plugins/internal/SimpleHoster.py +++ b/module/plugins/internal/SimpleHoster.py @@ -98,7 +98,8 @@ def parseFileInfo(self, url='', html=''): if hasattr(self, "html"): self.html = html - if hasattr(self, "FILE_OFFLINE_PATTERN") and re.search(self.FILE_OFFLINE_PATTERN, 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 info['status'] = 1 else: @@ -163,7 +164,7 @@ class PluginParseError(Exception): class SimpleHoster(Hoster): __name__ = "SimpleHoster" - __version__ = "0.33" + __version__ = "0.34" __pattern__ = None __type__ = "hoster" __description__ = """Simple hoster plugin""" @@ -172,16 +173,25 @@ class SimpleHoster(Hoster): """ Following patterns should be defined by each hoster: - FILE_INFO_PATTERN = r'(?Pfile_name) (?Pfile_size) (?Psize_unit)' - or - FILE_NAME_PATTERN = r'(?Pfile_name)' - FILE_SIZE_PATTERN = r'(?Pfile_size) (?Psize_unit)' - FILE_OFFLINE_PATTERN = r'File (deleted|not found)' - TEMP_OFFLINE_PATTERN = r'Server maintainance' + FILE_INFO_PATTERN: Name and Size of the file + example: FILE_INFO_PATTERN = r'(?Pfile_name) (?Pfile_size) (?Psize_unit)' + or + FILE_NAME_PATTERN: Name that will be set for the file + example: FILE_NAME_PATTERN = r'(?Pfile_name)' + FILE_SIZE_PATTERN: Size that will be checked for the file + example: FILE_SIZE_PATTERN = r'(?Pfile_size) (?Psize_unit)' - You can also define: - PREMIUM_ONLY_PATTERN = r'Premium account required' + 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' + + PREMIUM_ONLY_PATTERN: (optional) Checks if the file can be downloaded only with a premium account + example: PREMIUM_ONLY_PATTERN = r'Premium account required' """ FILE_SIZE_REPLACEMENTS = [] -- cgit v1.2.3