From 04038a2cf0c4c2d9cc9a0c8e8bf9beb6426afae8 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Thu, 10 Jul 2014 03:02:26 +0200 Subject: Use parseError instead PluginParseError + unified all download pattern attributes as LINK_PATTERN + removed some old patterns (not used anymore) + other code cosmetics --- module/plugins/hoster/GamefrontCom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hoster/GamefrontCom.py') diff --git a/module/plugins/hoster/GamefrontCom.py b/module/plugins/hoster/GamefrontCom.py index 0cd54d2ea..941aa2d50 100644 --- a/module/plugins/hoster/GamefrontCom.py +++ b/module/plugins/hoster/GamefrontCom.py @@ -17,7 +17,7 @@ class GamefrontCom(Hoster): PATTERN_FILENAME = r'(.*?) | Game Front' PATTERN_FILESIZE = r'<dt>File Size:</dt>[\n\s]*<dd>(.*?)</dd>' - PATTERN_OFFLINE = "This file doesn't exist, or has been removed." + PATTERN_OFFLINE = r"This file doesn't exist, or has been removed." def setup(self): self.resumeDownload = self.multiDL = True -- cgit v1.2.3 From 5060e4c6374a5116d0d8b02528f910f8c5f8bcf9 Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@gmail.com> Date: Tue, 15 Jul 2014 16:25:41 +0200 Subject: Fix code indentation, some bad whitespaces and missing authors + use 'not' instead 'is None' + replace __pattern__'s r" with r' + other minor cosmetics --- module/plugins/hoster/GamefrontCom.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hoster/GamefrontCom.py') diff --git a/module/plugins/hoster/GamefrontCom.py b/module/plugins/hoster/GamefrontCom.py index 941aa2d50..112451636 100644 --- a/module/plugins/hoster/GamefrontCom.py +++ b/module/plugins/hoster/GamefrontCom.py @@ -47,7 +47,7 @@ class GamefrontCom(Hoster): def _getName(self): name = re.search(self.PATTERN_FILENAME, self.html) - if name is None: + if not name: self.fail("%s: Plugin broken." % self.__name__) return name.group(1) @@ -71,7 +71,7 @@ def getInfo(urls): else: name = re.search(GamefrontCom.PATTERN_FILENAME, html) - if name is None: + if not name: result.append((url, 0, 1, url)) continue -- cgit v1.2.3 From 05d258d98dd8c2faf0b769840fa1e3c4acccdce8 Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@gmail.com> Date: Sun, 20 Jul 2014 03:25:14 +0200 Subject: Fix and improve 5060e4c6374a5116d0d8b02528f910f8c5f8bcf9 --- module/plugins/hoster/GamefrontCom.py | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) (limited to 'module/plugins/hoster/GamefrontCom.py') diff --git a/module/plugins/hoster/GamefrontCom.py b/module/plugins/hoster/GamefrontCom.py index 112451636..8e0f8565f 100644 --- a/module/plugins/hoster/GamefrontCom.py +++ b/module/plugins/hoster/GamefrontCom.py @@ -32,12 +32,12 @@ class GamefrontCom(Hoster): pyfile.name = self._getName() - self.link = self._getLink() + link = self._getLink() - if not self.link.startswith('http://'): - self.link = "http://www.gamefront.com/" + self.link + if not link.startswith('http://'): + link = "http://www.gamefront.com/" + link - self.download(self.link) + self.download(link) def _checkOnline(self): if re.search(self.PATTERN_OFFLINE, self.html): @@ -47,7 +47,7 @@ class GamefrontCom(Hoster): def _getName(self): name = re.search(self.PATTERN_FILENAME, self.html) - if not name: + if name is None: self.fail("%s: Plugin broken." % self.__name__) return name.group(1) @@ -55,9 +55,7 @@ class GamefrontCom(Hoster): def _getLink(self): self.html2 = self.load("http://www.gamefront.com/" + re.search("(files/service/thankyou\\?id=[A-Za-z0-9]+)", self.html).group(1)) - self.link = re.search("<a href=\"(http://media[0-9]+\.gamefront.com/.*)\">click here</a>", self.html2) - - return self.link.group(1).replace("&", "&") + return re.search("<a href=\"(http://media[0-9]+\.gamefront.com/.*)\">click here</a>", self.html2).group(1).replace("&", "&") def getInfo(urls): @@ -70,15 +68,13 @@ def getInfo(urls): result.append((url, 0, 1, url)) else: name = re.search(GamefrontCom.PATTERN_FILENAME, html) - - if not name: + if name is None: result.append((url, 0, 1, url)) - continue - - name = name.group(1) - size = re.search(GamefrontCom.PATTERN_FILESIZE, html) - size = parseFileSize(size.group(1)) + else: + name = name.group(1) + size = re.search(GamefrontCom.PATTERN_FILESIZE, html) + size = parseFileSize(size.group(1)) - result.append((name, size, 3, url)) + result.append((name, size, 3, url)) yield result -- cgit v1.2.3 From ba916633f2bedb04c7358000b91aed69f52e8e43 Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@gmail.com> Date: Fri, 1 Aug 2014 19:35:59 +0200 Subject: Remove trailing whitespaces + remove license headers + import urllib methods directly + sort and fix key attributes + use save_join instead join + sort some import declarations + other minor code cosmetics --- module/plugins/hoster/GamefrontCom.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'module/plugins/hoster/GamefrontCom.py') diff --git a/module/plugins/hoster/GamefrontCom.py b/module/plugins/hoster/GamefrontCom.py index 8e0f8565f..66cef3013 100644 --- a/module/plugins/hoster/GamefrontCom.py +++ b/module/plugins/hoster/GamefrontCom.py @@ -1,16 +1,19 @@ # -*- coding: utf-8 -*- import re -from module.plugins.Hoster import Hoster + from module.network.RequestFactory import getURL +from module.plugins.Hoster import Hoster from module.utils import parseFileSize class GamefrontCom(Hoster): __name__ = "GamefrontCom" __type__ = "hoster" - __pattern__ = r'http://(?:www\.)?gamefront.com/files/[A-Za-z0-9]+' __version__ = "0.04" + + __pattern__ = r'http://(?:www\.)?gamefront.com/files/[A-Za-z0-9]+' + __description__ = """Gamefront.com hoster plugin""" __author_name__ = "fwannmacher" __author_mail__ = "felipe@warhammerproject.com" @@ -19,6 +22,7 @@ class GamefrontCom(Hoster): PATTERN_FILESIZE = r'<dt>File Size:</dt>[\n\s]*<dd>(.*?)</dd>' PATTERN_OFFLINE = r"This file doesn't exist, or has been removed." + def setup(self): self.resumeDownload = self.multiDL = True self.chunkLimit = -1 -- cgit v1.2.3