From f000135de9d6de7277080683c2b9d396da65e7f5 Mon Sep 17 00:00:00 2001 From: prOq Date: Fri, 24 Oct 2014 19:29:58 +0200 Subject: [FileSharkPl] Recovered needed behaviour Conflicts: module/plugins/hoster/FileSharkPl.py --- module/plugins/hoster/FileSharkPl.py | 38 ++++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 13 deletions(-) (limited to 'module/plugins/hoster') diff --git a/module/plugins/hoster/FileSharkPl.py b/module/plugins/hoster/FileSharkPl.py index 5a9cbb456..5683d2a9e 100644 --- a/module/plugins/hoster/FileSharkPl.py +++ b/module/plugins/hoster/FileSharkPl.py @@ -10,7 +10,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class FileSharkPl(SimpleHoster): __name__ = "FileSharkPl" __type__ = "hoster" - __version__ = "0.01" + __version__ = "0.02" __pattern__ = r'http://(?:www\.)?fileshark\.pl/pobierz/\d{6}/\w{5}' @@ -50,20 +50,32 @@ class FileSharkPl(SimpleHoster): def prepare(self): super(FileSharkPl, self).prepare() + # check if file is now available for download (-> file name can be found in html body) + try: + m = re.search(self.FILE_NAME_PATTERN, self.html) + pyfile.name = m.group('N') + except: + try: + m = re.match(self.__pattern__, pyfile.url) + pyfile.name = m.group(1) + except: + pyfile.name = "NoName" + + sec = re.search(self.SECONDS_PATTERN, self.html) + if sec: + self.retry(15,int(sec.group(1)),"Another download already run") + m = re.search(self.DOWNLOAD_ALERT, self.html): if m: - return - - alert = m.group(1) - - if re.match(self.IP_BLOCKED_PATTERN, alert): - self.fail(_("Only connections from Polish IP are allowed")) - elif re.match(self.DOWNLOAD_SLOTS_ERROR_PATTERN, alert): - self.logInfo(_("No free download slots available")) - self.retry(10, 30 * 60, _("Still no free download slots available")) - else: - self.logInfo(alert) - self.retry(10, 10 * 60, _("Try again later")) + alert = m.group(1) + if re.match(self.IP_BLOCKED_PATTERN, alert): + self.fail(_("Only connections from Polish IP are allowed")) + elif re.match(self.DOWNLOAD_SLOTS_ERROR_PATTERN, alert): + self.logInfo(_("No free download slots available")) + self.retry(10, 30 * 60, _("Still no free download slots available")) + else: + self.logInfo(alert) + self.retry(10, 10 * 60, _("Try again later")) #@NOTE: handlePremium method was never been tested -- cgit v1.2.3