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 From b0868ae6446078bacf1635dde5e4ab316b4a94cb Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@gmail.com> Date: Tue, 7 Oct 2014 18:57:59 +0200 Subject: New __authors__ key replaces __author_name__ and __author_mail__ + Whitespaces and EOF fixup --- 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 66cef3013..9acd12060 100644 --- a/module/plugins/hoster/GamefrontCom.py +++ b/module/plugins/hoster/GamefrontCom.py @@ -15,8 +15,8 @@ class GamefrontCom(Hoster): __pattern__ = r'http://(?:www\.)?gamefront.com/files/[A-Za-z0-9]+' __description__ = """Gamefront.com hoster plugin""" - __author_name__ = "fwannmacher" - __author_mail__ = "felipe@warhammerproject.com" + __authors__ = [("fwannmacher", "felipe@warhammerproject.com")] + PATTERN_FILENAME = r'<title>(.*?) | Game Front' PATTERN_FILESIZE = r'<dt>File Size:</dt>[\n\s]*<dd>(.*?)</dd>' -- cgit v1.2.3 From ae7a7e66981456e5bbe2b54006d79b6f907be7a4 Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@gmail.com> Date: Wed, 8 Oct 2014 20:18:13 +0200 Subject: Add __license__ key attribute to plugins --- module/plugins/hoster/GamefrontCom.py | 1 + 1 file changed, 1 insertion(+) (limited to 'module/plugins/hoster/GamefrontCom.py') diff --git a/module/plugins/hoster/GamefrontCom.py b/module/plugins/hoster/GamefrontCom.py index 9acd12060..da16b0eb5 100644 --- a/module/plugins/hoster/GamefrontCom.py +++ b/module/plugins/hoster/GamefrontCom.py @@ -15,6 +15,7 @@ class GamefrontCom(Hoster): __pattern__ = r'http://(?:www\.)?gamefront.com/files/[A-Za-z0-9]+' __description__ = """Gamefront.com hoster plugin""" + __license__ = "GPLv3" __authors__ = [("fwannmacher", "felipe@warhammerproject.com")] -- cgit v1.2.3 From f76e5c2336718dca9da8033ba22cd83c72c7b3b3 Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@gmail.com> Date: Sat, 11 Oct 2014 15:14:28 +0200 Subject: Pattern update 1 --- module/plugins/hoster/GamefrontCom.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'module/plugins/hoster/GamefrontCom.py') diff --git a/module/plugins/hoster/GamefrontCom.py b/module/plugins/hoster/GamefrontCom.py index da16b0eb5..413b9ee10 100644 --- a/module/plugins/hoster/GamefrontCom.py +++ b/module/plugins/hoster/GamefrontCom.py @@ -12,7 +12,7 @@ class GamefrontCom(Hoster): __type__ = "hoster" __version__ = "0.04" - __pattern__ = r'http://(?:www\.)?gamefront.com/files/[A-Za-z0-9]+' + __pattern__ = r'http://(?:www\.)?gamefront.com/files/\w+' __description__ = """Gamefront.com hoster plugin""" __license__ = "GPLv3" @@ -58,9 +58,9 @@ class GamefrontCom(Hoster): return name.group(1) def _getLink(self): - self.html2 = self.load("http://www.gamefront.com/" + re.search("(files/service/thankyou\\?id=[A-Za-z0-9]+)", + self.html2 = self.load("http://www.gamefront.com/" + re.search("(files/service/thankyou\\?id=\w+)", self.html).group(1)) - return re.search("<a href=\"(http://media[0-9]+\.gamefront.com/.*)\">click here</a>", self.html2).group(1).replace("&", "&") + return re.search("<a href=\"(http://media\d+\.gamefront.com/.*)\">click here</a>", self.html2).group(1).replace("&", "&") def getInfo(urls): -- cgit v1.2.3 From c5d1a4fd8943877c6d2eb3843e0de725dba5191e Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@gmail.com> Date: Sat, 11 Oct 2014 15:09:53 +0200 Subject: Pattern update 2 --- 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 413b9ee10..a9faf6783 100644 --- a/module/plugins/hoster/GamefrontCom.py +++ b/module/plugins/hoster/GamefrontCom.py @@ -12,7 +12,7 @@ class GamefrontCom(Hoster): __type__ = "hoster" __version__ = "0.04" - __pattern__ = r'http://(?:www\.)?gamefront.com/files/\w+' + __pattern__ = r'http://(?:www\.)?gamefront\.com/files/\w+' __description__ = """Gamefront.com hoster plugin""" __license__ = "GPLv3" -- cgit v1.2.3 From 8939f015a688a07ec7d0bd14b6a3704f6a2cb4a0 Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@gmail.com> Date: Sat, 11 Oct 2014 15:12:40 +0200 Subject: Pattern update 3 --- 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 a9faf6783..b7e7f0bc8 100644 --- a/module/plugins/hoster/GamefrontCom.py +++ b/module/plugins/hoster/GamefrontCom.py @@ -21,7 +21,7 @@ class GamefrontCom(Hoster): PATTERN_FILENAME = r'<title>(.*?) | Game Front' PATTERN_FILESIZE = r'<dt>File Size:</dt>[\n\s]*<dd>(.*?)</dd>' - PATTERN_OFFLINE = r"This file doesn't exist, or has been removed." + PATTERN_OFFLINE = r'This file doesn\'t exist, or has been removed.' def setup(self): -- cgit v1.2.3 From 0eb6e7ec4a1144dcca824d8add049787d3da1762 Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@gmail.com> Date: Wed, 22 Oct 2014 19:44:59 +0200 Subject: Two space before function declaration --- module/plugins/hoster/GamefrontCom.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'module/plugins/hoster/GamefrontCom.py') diff --git a/module/plugins/hoster/GamefrontCom.py b/module/plugins/hoster/GamefrontCom.py index b7e7f0bc8..2009d06ab 100644 --- a/module/plugins/hoster/GamefrontCom.py +++ b/module/plugins/hoster/GamefrontCom.py @@ -28,6 +28,7 @@ class GamefrontCom(Hoster): self.resumeDownload = self.multiDL = True self.chunkLimit = -1 + def process(self, pyfile): self.pyfile = pyfile self.html = self.load(pyfile.url, decode=True) @@ -44,12 +45,14 @@ class GamefrontCom(Hoster): self.download(link) + def _checkOnline(self): if re.search(self.PATTERN_OFFLINE, self.html): return False else: return True + def _getName(self): name = re.search(self.PATTERN_FILENAME, self.html) if name is None: @@ -57,6 +60,7 @@ class GamefrontCom(Hoster): return name.group(1) + def _getLink(self): self.html2 = self.load("http://www.gamefront.com/" + re.search("(files/service/thankyou\\?id=\w+)", self.html).group(1)) -- cgit v1.2.3 From 9f2ebe486a3e155fb6a60e07cccb77ab6a772eb2 Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@gmail.com> Date: Sun, 26 Oct 2014 02:31:54 +0200 Subject: Extend translation support in plugins + a lot of code cosmetics and typo fixes --- 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 2009d06ab..e36e5a570 100644 --- a/module/plugins/hoster/GamefrontCom.py +++ b/module/plugins/hoster/GamefrontCom.py @@ -56,7 +56,7 @@ class GamefrontCom(Hoster): def _getName(self): name = re.search(self.PATTERN_FILENAME, self.html) if name is None: - self.fail("%s: Plugin broken." % self.__name__) + self.fail(_("Plugin broken") return name.group(1) -- cgit v1.2.3 From 34984dae733c3f3d47b41a0acfba3724d53c65a1 Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@gmail.com> Date: Tue, 28 Oct 2014 16:52:10 +0100 Subject: Code cosmetics: plugin class attributes --- module/plugins/hoster/GamefrontCom.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'module/plugins/hoster/GamefrontCom.py') diff --git a/module/plugins/hoster/GamefrontCom.py b/module/plugins/hoster/GamefrontCom.py index e36e5a570..919d40891 100644 --- a/module/plugins/hoster/GamefrontCom.py +++ b/module/plugins/hoster/GamefrontCom.py @@ -8,15 +8,15 @@ from module.utils import parseFileSize class GamefrontCom(Hoster): - __name__ = "GamefrontCom" - __type__ = "hoster" + __name__ = "GamefrontCom" + __type__ = "hoster" __version__ = "0.04" __pattern__ = r'http://(?:www\.)?gamefront\.com/files/\w+' __description__ = """Gamefront.com hoster plugin""" - __license__ = "GPLv3" - __authors__ = [("fwannmacher", "felipe@warhammerproject.com")] + __license__ = "GPLv3" + __authors__ = [("fwannmacher", "felipe@warhammerproject.com")] PATTERN_FILENAME = r'<title>(.*?) | Game Front' -- cgit v1.2.3 From 67587fbe0335cacfde28a86ba729b9d567ce1da7 Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@gmail.com> Date: Sun, 7 Dec 2014 00:27:18 +0100 Subject: Plugin code cosmetics (3) --- module/plugins/hoster/GamefrontCom.py | 5 +++-- 1 file changed, 3 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 919d40891..c68866f87 100644 --- a/module/plugins/hoster/GamefrontCom.py +++ b/module/plugins/hoster/GamefrontCom.py @@ -25,8 +25,9 @@ class GamefrontCom(Hoster): def setup(self): - self.resumeDownload = self.multiDL = True - self.chunkLimit = -1 + self.resumeDownload = True + self.multiDL = True + self.chunkLimit = -1 def process(self, pyfile): -- cgit v1.2.3