diff options
author | Walter Purcaro <vuolter@users.noreply.github.com> | 2015-04-08 15:38:01 +0200 |
---|---|---|
committer | Walter Purcaro <vuolter@users.noreply.github.com> | 2015-04-08 15:38:01 +0200 |
commit | 02e3ede3edcf4415ac466fbea9d4f25d9ccc8671 (patch) | |
tree | 81084f9263f9229790e62097957d5132f18028e9 /module/plugins/hoster | |
parent | [UserAgentSwitcher] Random user-agent feature (diff) | |
download | pyload-02e3ede3edcf4415ac466fbea9d4f25d9ccc8671.tar.xz |
Spare code cosmetics
Diffstat (limited to 'module/plugins/hoster')
-rw-r--r-- | module/plugins/hoster/EuroshareEu.py | 2 | ||||
-rw-r--r-- | module/plugins/hoster/FreakshareCom.py | 20 | ||||
-rw-r--r-- | module/plugins/hoster/NetloadIn.py | 2 | ||||
-rw-r--r-- | module/plugins/hoster/OverLoadMe.py | 2 | ||||
-rw-r--r-- | module/plugins/hoster/PornhubCom.py | 2 | ||||
-rw-r--r-- | module/plugins/hoster/RealdebridCom.py | 2 | ||||
-rw-r--r-- | module/plugins/hoster/RedtubeCom.py | 2 | ||||
-rw-r--r-- | module/plugins/hoster/ShareplaceCom.py | 2 | ||||
-rw-r--r-- | module/plugins/hoster/XHamsterCom.py | 2 | ||||
-rw-r--r-- | module/plugins/hoster/YoupornCom.py | 2 | ||||
-rw-r--r-- | module/plugins/hoster/YourfilesTo.py | 2 |
11 files changed, 21 insertions, 19 deletions
diff --git a/module/plugins/hoster/EuroshareEu.py b/module/plugins/hoster/EuroshareEu.py index c5059e69e..922665c2e 100644 --- a/module/plugins/hoster/EuroshareEu.py +++ b/module/plugins/hoster/EuroshareEu.py @@ -48,7 +48,7 @@ class EuroshareEu(SimpleHoster): def handleFree(self, pyfile): - if re.search(self.ERR_PARDL_PATTERN, self.html) is not None: + if re.search(self.ERR_PARDL_PATTERN, self.html): self.longWait(5 * 60, 12) m = re.search(self.LINK_FREE_PATTERN, self.html) diff --git a/module/plugins/hoster/FreakshareCom.py b/module/plugins/hoster/FreakshareCom.py index 9a11f933d..6a595e75b 100644 --- a/module/plugins/hoster/FreakshareCom.py +++ b/module/plugins/hoster/FreakshareCom.py @@ -107,12 +107,14 @@ class FreakshareCom(Hoster): def get_file_name(self): if not self.html: self.download_html() + if not self.wantReconnect: - file_name = re.search(r"<h1\sclass=\"box_heading\"\sstyle=\"text-align:center;\">([^ ]+)", self.html) - if file_name is not None: - file_name = file_name.group(1) + m = re.search(r"<h1\sclass=\"box_heading\"\sstyle=\"text-align:center;\">([^ ]+)", self.html) + if m: + file_name = m.group(1) else: file_name = self.pyfile.url + return file_name else: return self.pyfile.url @@ -122,12 +124,12 @@ class FreakshareCom(Hoster): size = 0 if not self.html: self.download_html() + if not self.wantReconnect: - file_size_check = re.search( - r"<h1\sclass=\"box_heading\"\sstyle=\"text-align:center;\">[^ ]+ - ([^ ]+) (\w\w)yte", self.html) - if file_size_check is not None: - units = float(file_size_check.group(1).replace(",", "")) - pow = {'KB': 1, 'MB': 2, 'GB': 3}[file_size_check.group(2)] + m = re.search(r"<h1\sclass=\"box_heading\"\sstyle=\"text-align:center;\">[^ ]+ - ([^ ]+) (\w\w)yte", self.html) + if m: + units = float(m.group(1).replace(",", "")) + pow = {'KB': 1, 'MB': 2, 'GB': 3}[m.group(2)] size = int(units * 1024 ** pow) return size @@ -153,7 +155,7 @@ class FreakshareCom(Hoster): """ if not self.html: self.download_html() - if re.search(r"This file does not exist!", self.html) is not None: + if re.search(r"This file does not exist!", self.html): return False else: return True diff --git a/module/plugins/hoster/NetloadIn.py b/module/plugins/hoster/NetloadIn.py index 0ff3c25d3..57af3f18e 100644 --- a/module/plugins/hoster/NetloadIn.py +++ b/module/plugins/hoster/NetloadIn.py @@ -268,7 +268,7 @@ class NetloadIn(Hoster): try: file_url_pattern = r'<a class="Orange_Link" href="(http://.+)".?>Or click here' attempt = re.search(file_url_pattern, page) - if attempt is not None: + if attempt: return attempt.group(1) else: self.logDebug("Backup try for final link") diff --git a/module/plugins/hoster/OverLoadMe.py b/module/plugins/hoster/OverLoadMe.py index 398946e43..934de5746 100644 --- a/module/plugins/hoster/OverLoadMe.py +++ b/module/plugins/hoster/OverLoadMe.py @@ -42,7 +42,7 @@ class OverLoadMe(MultiHoster): self.logWarning(data['msg']) self.tempOffline() else: - if pyfile.name is not None and pyfile.name.endswith('.tmp') and data['filename']: + if pyfile.name and pyfile.name.endswith('.tmp') and data['filename']: pyfile.name = data['filename'] pyfile.size = parseFileSize(data['filesize']) diff --git a/module/plugins/hoster/PornhubCom.py b/module/plugins/hoster/PornhubCom.py index 9e0b16a85..16ce36ea9 100644 --- a/module/plugins/hoster/PornhubCom.py +++ b/module/plugins/hoster/PornhubCom.py @@ -83,7 +83,7 @@ class PornhubCom(Hoster): if not self.html: self.download_html() - if re.search(r'This video is no longer in our database or is in conversion', self.html) is not None: + if re.search(r'This video is no longer in our database or is in conversion', self.html): return False else: return True diff --git a/module/plugins/hoster/RealdebridCom.py b/module/plugins/hoster/RealdebridCom.py index 1a8715e0e..f35eb5e03 100644 --- a/module/plugins/hoster/RealdebridCom.py +++ b/module/plugins/hoster/RealdebridCom.py @@ -44,7 +44,7 @@ class RealdebridCom(MultiHoster): self.logWarning(data['message']) self.tempOffline() else: - if pyfile.name is not None and pyfile.name.endswith('.tmp') and data['file_name']: + if pyfile.name and pyfile.name.endswith('.tmp') and data['file_name']: pyfile.name = data['file_name'] pyfile.size = parseFileSize(data['file_size']) self.link = data['generated_links'][0][-1] diff --git a/module/plugins/hoster/RedtubeCom.py b/module/plugins/hoster/RedtubeCom.py index d68fbe262..9051c498a 100644 --- a/module/plugins/hoster/RedtubeCom.py +++ b/module/plugins/hoster/RedtubeCom.py @@ -56,7 +56,7 @@ class RedtubeCom(Hoster): if not self.html: self.download_html() - if re.search(r'This video has been removed.', self.html) is not None: + if re.search(r'This video has been removed.', self.html): return False else: return True diff --git a/module/plugins/hoster/ShareplaceCom.py b/module/plugins/hoster/ShareplaceCom.py index 07724a9d1..c540dd2df 100644 --- a/module/plugins/hoster/ShareplaceCom.py +++ b/module/plugins/hoster/ShareplaceCom.py @@ -83,7 +83,7 @@ class ShareplaceCom(Hoster): if not self.html: self.download_html() - if re.search(r"HTTP Status 404", self.html) is not None: + if re.search(r"HTTP Status 404", self.html): return False else: return True diff --git a/module/plugins/hoster/XHamsterCom.py b/module/plugins/hoster/XHamsterCom.py index fd494e099..9004dbac0 100644 --- a/module/plugins/hoster/XHamsterCom.py +++ b/module/plugins/hoster/XHamsterCom.py @@ -123,7 +123,7 @@ class XHamsterCom(Hoster): """ if not self.html: self.download_html() - if re.search(r"(.*Video not found.*)", self.html) is not None: + if re.search(r"(.*Video not found.*)", self.html): return False else: return True diff --git a/module/plugins/hoster/YoupornCom.py b/module/plugins/hoster/YoupornCom.py index 4bb2520e6..19d07fa36 100644 --- a/module/plugins/hoster/YoupornCom.py +++ b/module/plugins/hoster/YoupornCom.py @@ -54,7 +54,7 @@ class YoupornCom(Hoster): """ if not self.html: self.download_html() - if re.search(r"(.*invalid video_id.*)", self.html) is not None: + if re.search(r"(.*invalid video_id.*)", self.html): return False else: return True diff --git a/module/plugins/hoster/YourfilesTo.py b/module/plugins/hoster/YourfilesTo.py index e0def108e..fd65a6a41 100644 --- a/module/plugins/hoster/YourfilesTo.py +++ b/module/plugins/hoster/YourfilesTo.py @@ -81,7 +81,7 @@ class YourfilesTo(Hoster): if not self.html: self.download_html() - if re.search(r"HTTP Status 404", self.html) is not None: + if re.search(r"HTTP Status 404", self.html): return False else: return True |