From cc5accb444abc29bd0e23e6a0f78cf5f5a993640 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Thu, 30 Apr 2015 19:20:11 +0200 Subject: Spare code cosmetics --- module/plugins/hoster/BasePlugin.py | 4 ++-- module/plugins/hoster/Ftp.py | 4 ++-- module/plugins/hoster/UpleaCom.py | 17 +++++++---------- module/plugins/hoster/UploadedTo.py | 2 +- 4 files changed, 12 insertions(+), 15 deletions(-) diff --git a/module/plugins/hoster/BasePlugin.py b/module/plugins/hoster/BasePlugin.py index 418f446eb..28a916fe8 100644 --- a/module/plugins/hoster/BasePlugin.py +++ b/module/plugins/hoster/BasePlugin.py @@ -13,7 +13,7 @@ from module.plugins.Hoster import Hoster class BasePlugin(Hoster): __name__ = "BasePlugin" __type__ = "hoster" - __version__ = "0.41" + __version__ = "0.42" __pattern__ = r'^unmatchable$' @@ -46,7 +46,7 @@ class BasePlugin(Hoster): try: if disposition: content = urllib2.urlopen(url).info()['Content-Disposition'].split(';') - self.pyfile.name = content[1].split('filename=')[1][1:-1] or self.pyfile.name + self.pyfile.name = content[1].split('filename=')[1].strip('"\'') or self.pyfile.name finally: return super(BasePlugin, self).download(url, get, post, ref, cookies, False) diff --git a/module/plugins/hoster/Ftp.py b/module/plugins/hoster/Ftp.py index cfe230f42..546845ca0 100644 --- a/module/plugins/hoster/Ftp.py +++ b/module/plugins/hoster/Ftp.py @@ -12,7 +12,7 @@ from module.plugins.Hoster import Hoster class Ftp(Hoster): __name__ = "Ftp" __type__ = "hoster" - __version__ = "0.49" + __version__ = "0.50" __pattern__ = r'(?:ftps?|sftp)://([\w.-]+(:[\w.-]+)?@)?[\w.-]+(:\d+)?/.+' @@ -33,7 +33,7 @@ class Ftp(Hoster): try: if disposition: content = urllib2.urlopen(url).info()['Content-Disposition'].split(';') - self.pyfile.name = content[1].split('filename=')[1][1:-1] or self.pyfile.name + self.pyfile.name = content[1].split('filename=')[1].strip('"\'') or self.pyfile.name finally: return super(Ftp, self).download(url, get, post, ref, cookies, False) diff --git a/module/plugins/hoster/UpleaCom.py b/module/plugins/hoster/UpleaCom.py index 608282a60..4538b1c16 100644 --- a/module/plugins/hoster/UpleaCom.py +++ b/module/plugins/hoster/UpleaCom.py @@ -22,18 +22,19 @@ class UpleaCom(XFSHoster): DISPOSITION = False #@TODO: Remove in 0.4.10 - NAME_PATTERN = r'(?P.+?)' - SIZE_PATTERN = r'(?P[\d.,]+) (?P[\w^_]+?)' + HOSTER_DOMAIN = "uplea.com" + SIZE_REPLACEMENTS = [('ko','KB'), ('mo','MB'), ('go','GB'), ('Ko','KB'), ('Mo','MB'), ('Go','GB')] + NAME_PATTERN = r'(?P.+?)' + SIZE_PATTERN = r'(?P[\d.,]+) (?P[\w^_]+?)' OFFLINE_PATTERN = r'>You followed an invalid or expired link' - PREMIUM_PATTERN = r'You need to have a Premium subscription to download this file' LINK_PATTERN = r'"(https?://\w+\.uplea\.com/anonym/.*?)"' - HOSTER_DOMAIN = "uplea.com" - WAIT_PATTERN = r'timeText: ?([\d.]+),' - STEP_PATTERN = r'' + PREMIUM_ONLY_PATTERN = r'You need to have a Premium subscription to download this file' + WAIT_PATTERN = r'timeText: ?([\d.]+),' + STEP_PATTERN = r'' def setup(self): @@ -55,10 +56,6 @@ class UpleaCom(XFSHoster): self.wait(m.group(1), True) self.retry() - m = re.search(self.PREMIUM_PATTERN, self.html) - if m: - self.error(_("This URL requires a premium account")) - m = re.search(self.LINK_PATTERN, self.html) if m is None: self.error(_("LINK_PATTERN not found")) diff --git a/module/plugins/hoster/UploadedTo.py b/module/plugins/hoster/UploadedTo.py index 8a426d28d..75710ea8b 100644 --- a/module/plugins/hoster/UploadedTo.py +++ b/module/plugins/hoster/UploadedTo.py @@ -27,7 +27,7 @@ class UploadedTo(SimpleHoster): URL_REPLACEMENTS = [(__pattern__ + ".*", r'http://uploaded.net/file/\g')] - TEMP_OFFLINE_PATTERN = r'uploaded\.net - Maintenance - Wartungsarbeiten' + TEMP_OFFLINE_PATTERN = r'uploaded\.net - Maintenance' LINK_PREMIUM_PATTERN = r'<div class="tfree".*\s*<form method="post" action="(.+?)"' -- cgit v1.2.3