From 7b8c458cca7d21a029620f98e453f746fce69cd1 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 14 Jul 2014 16:10:01 +0200 Subject: Prefer single quote for dict key name --- module/plugins/hoster/FastixRu.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hoster/FastixRu.py') diff --git a/module/plugins/hoster/FastixRu.py b/module/plugins/hoster/FastixRu.py index 8eeabc17c..a59fae498 100644 --- a/module/plugins/hoster/FastixRu.py +++ b/module/plugins/hoster/FastixRu.py @@ -38,7 +38,7 @@ class FastixRu(Hoster): else: self.logDebug("Old URL: %s" % pyfile.url) api_key = self.account.getAccountData(self.user) - api_key = api_key["api"] + api_key = api_key['api'] url = "http://fastix.ru/api_v2/?apikey=%s&sub=getdirectlink&link=%s" % (api_key, pyfile.url) page = self.load(url) data = json_loads(page) @@ -46,7 +46,7 @@ class FastixRu(Hoster): if "error\":true" in page: self.offline() else: - new_url = data["downloadlink"] + new_url = data['downloadlink'] if new_url != pyfile.url: self.logDebug("New URL: %s" % new_url) -- cgit v1.2.3 From ba916633f2bedb04c7358000b91aed69f52e8e43 Mon Sep 17 00:00:00 2001 From: Walter Purcaro 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/FastixRu.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'module/plugins/hoster/FastixRu.py') diff --git a/module/plugins/hoster/FastixRu.py b/module/plugins/hoster/FastixRu.py index a59fae498..199544840 100644 --- a/module/plugins/hoster/FastixRu.py +++ b/module/plugins/hoster/FastixRu.py @@ -1,21 +1,26 @@ # -*- coding: utf-8 -*- import re -from urllib import unquote + from random import randrange -from module.plugins.Hoster import Hoster +from urllib import unquote + from module.common.json_layer import json_loads +from module.plugins.Hoster import Hoster class FastixRu(Hoster): __name__ = "FastixRu" - __version__ = "0.04" __type__ = "hoster" + __version__ = "0.04" + __pattern__ = r'http://(?:www\.)?fastix\.(ru|it)/file/(?P[a-zA-Z0-9]{24})' + __description__ = """Fastix hoster plugin""" __author_name__ = "Massimo Rosamilia" __author_mail__ = "max@spiritix.eu" + def getFilename(self, url): try: name = unquote(url.rsplit("/", 1)[1]) -- cgit v1.2.3 From 0d220d634e512d89bda540f91c643b361c82ea8a Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 27 Sep 2014 01:38:32 +0200 Subject: Logging string cosmetics --- module/plugins/hoster/FastixRu.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hoster/FastixRu.py') diff --git a/module/plugins/hoster/FastixRu.py b/module/plugins/hoster/FastixRu.py index 199544840..59f88a32b 100644 --- a/module/plugins/hoster/FastixRu.py +++ b/module/plugins/hoster/FastixRu.py @@ -47,7 +47,7 @@ class FastixRu(Hoster): url = "http://fastix.ru/api_v2/?apikey=%s&sub=getdirectlink&link=%s" % (api_key, pyfile.url) page = self.load(url) data = json_loads(page) - self.logDebug("Json data: %s" % str(data)) + self.logDebug("Json data", data) if "error\":true" in page: self.offline() else: -- cgit v1.2.3 From b0868ae6446078bacf1635dde5e4ab316b4a94cb Mon Sep 17 00:00:00 2001 From: Walter Purcaro 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/FastixRu.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'module/plugins/hoster/FastixRu.py') diff --git a/module/plugins/hoster/FastixRu.py b/module/plugins/hoster/FastixRu.py index 59f88a32b..87b5234c5 100644 --- a/module/plugins/hoster/FastixRu.py +++ b/module/plugins/hoster/FastixRu.py @@ -17,8 +17,7 @@ class FastixRu(Hoster): __pattern__ = r'http://(?:www\.)?fastix\.(ru|it)/file/(?P[a-zA-Z0-9]{24})' __description__ = """Fastix hoster plugin""" - __author_name__ = "Massimo Rosamilia" - __author_mail__ = "max@spiritix.eu" + __authors__ = [("Massimo Rosamilia", "max@spiritix.eu")] def getFilename(self, url): -- cgit v1.2.3 From ae7a7e66981456e5bbe2b54006d79b6f907be7a4 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 8 Oct 2014 20:18:13 +0200 Subject: Add __license__ key attribute to plugins --- module/plugins/hoster/FastixRu.py | 1 + 1 file changed, 1 insertion(+) (limited to 'module/plugins/hoster/FastixRu.py') diff --git a/module/plugins/hoster/FastixRu.py b/module/plugins/hoster/FastixRu.py index 87b5234c5..ca22638f1 100644 --- a/module/plugins/hoster/FastixRu.py +++ b/module/plugins/hoster/FastixRu.py @@ -17,6 +17,7 @@ class FastixRu(Hoster): __pattern__ = r'http://(?:www\.)?fastix\.(ru|it)/file/(?P[a-zA-Z0-9]{24})' __description__ = """Fastix hoster plugin""" + __license__ = "GPLv3" __authors__ = [("Massimo Rosamilia", "max@spiritix.eu")] -- cgit v1.2.3 From f76e5c2336718dca9da8033ba22cd83c72c7b3b3 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 11 Oct 2014 15:14:28 +0200 Subject: Pattern update 1 --- module/plugins/hoster/FastixRu.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hoster/FastixRu.py') diff --git a/module/plugins/hoster/FastixRu.py b/module/plugins/hoster/FastixRu.py index ca22638f1..7f61f7d7c 100644 --- a/module/plugins/hoster/FastixRu.py +++ b/module/plugins/hoster/FastixRu.py @@ -14,7 +14,7 @@ class FastixRu(Hoster): __type__ = "hoster" __version__ = "0.04" - __pattern__ = r'http://(?:www\.)?fastix\.(ru|it)/file/(?P[a-zA-Z0-9]{24})' + __pattern__ = r'http://(?:www\.)?fastix\.(ru|it)/file/(?P\w{24})' __description__ = """Fastix hoster plugin""" __license__ = "GPLv3" -- cgit v1.2.3 From 0eb6e7ec4a1144dcca824d8add049787d3da1762 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 22 Oct 2014 19:44:59 +0200 Subject: Two space before function declaration --- module/plugins/hoster/FastixRu.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'module/plugins/hoster/FastixRu.py') diff --git a/module/plugins/hoster/FastixRu.py b/module/plugins/hoster/FastixRu.py index 7f61f7d7c..b1e834c61 100644 --- a/module/plugins/hoster/FastixRu.py +++ b/module/plugins/hoster/FastixRu.py @@ -30,10 +30,12 @@ class FastixRu(Hoster): name += "%s.tmp" % randrange(100, 999) return name + def setup(self): self.chunkLimit = 3 self.resumeDownload = True + def process(self, pyfile): if re.match(self.__pattern__, pyfile.url): new_url = pyfile.url -- cgit v1.2.3 From 9f2ebe486a3e155fb6a60e07cccb77ab6a772eb2 Mon Sep 17 00:00:00 2001 From: Walter Purcaro 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/FastixRu.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'module/plugins/hoster/FastixRu.py') diff --git a/module/plugins/hoster/FastixRu.py b/module/plugins/hoster/FastixRu.py index b1e834c61..cb6c44eb7 100644 --- a/module/plugins/hoster/FastixRu.py +++ b/module/plugins/hoster/FastixRu.py @@ -41,7 +41,7 @@ class FastixRu(Hoster): new_url = pyfile.url elif not self.account: self.logError(_("Please enter your %s account or deactivate this plugin") % "Fastix") - self.fail("No Fastix account provided") + self.fail(_("No Fastix account provided")) else: self.logDebug("Old URL: %s" % pyfile.url) api_key = self.account.getAccountData(self.user) @@ -68,6 +68,6 @@ class FastixRu(Hoster): "empty": re.compile(r"^$")}) if check == "error": - self.retry(wait_time=60, reason="An error occurred while generating link.") + self.retry(wait_time=60, reason="An error occurred while generating link") elif check == "empty": - self.retry(wait_time=60, reason="Downloaded File was empty.") + self.retry(wait_time=60, reason="Downloaded File was empty") -- cgit v1.2.3 From 146fe1e309c33ab149bfaf58ad86c0dd4fb9b156 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 27 Oct 2014 01:18:45 +0100 Subject: Spare code cosmetics --- module/plugins/hoster/FastixRu.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hoster/FastixRu.py') diff --git a/module/plugins/hoster/FastixRu.py b/module/plugins/hoster/FastixRu.py index cb6c44eb7..eddcd2fe6 100644 --- a/module/plugins/hoster/FastixRu.py +++ b/module/plugins/hoster/FastixRu.py @@ -68,6 +68,6 @@ class FastixRu(Hoster): "empty": re.compile(r"^$")}) if check == "error": - self.retry(wait_time=60, reason="An error occurred while generating link") + self.retry(wait_time=60, reason=_("An error occurred while generating link")) elif check == "empty": - self.retry(wait_time=60, reason="Downloaded File was empty") + self.retry(wait_time=60, reason=_("Downloaded File was empty")) -- cgit v1.2.3 From 34984dae733c3f3d47b41a0acfba3724d53c65a1 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 28 Oct 2014 16:52:10 +0100 Subject: Code cosmetics: plugin class attributes --- module/plugins/hoster/FastixRu.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'module/plugins/hoster/FastixRu.py') diff --git a/module/plugins/hoster/FastixRu.py b/module/plugins/hoster/FastixRu.py index eddcd2fe6..59b4bd24f 100644 --- a/module/plugins/hoster/FastixRu.py +++ b/module/plugins/hoster/FastixRu.py @@ -10,15 +10,15 @@ from module.plugins.Hoster import Hoster class FastixRu(Hoster): - __name__ = "FastixRu" - __type__ = "hoster" + __name__ = "FastixRu" + __type__ = "hoster" __version__ = "0.04" __pattern__ = r'http://(?:www\.)?fastix\.(ru|it)/file/(?P\w{24})' __description__ = """Fastix hoster plugin""" - __license__ = "GPLv3" - __authors__ = [("Massimo Rosamilia", "max@spiritix.eu")] + __license__ = "GPLv3" + __authors__ = [("Massimo Rosamilia", "max@spiritix.eu")] def getFilename(self, url): -- cgit v1.2.3 From 67587fbe0335cacfde28a86ba729b9d567ce1da7 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 7 Dec 2014 00:27:18 +0100 Subject: Plugin code cosmetics (3) --- module/plugins/hoster/FastixRu.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'module/plugins/hoster/FastixRu.py') diff --git a/module/plugins/hoster/FastixRu.py b/module/plugins/hoster/FastixRu.py index 59b4bd24f..1e47638ea 100644 --- a/module/plugins/hoster/FastixRu.py +++ b/module/plugins/hoster/FastixRu.py @@ -46,10 +46,13 @@ class FastixRu(Hoster): self.logDebug("Old URL: %s" % pyfile.url) api_key = self.account.getAccountData(self.user) api_key = api_key['api'] - url = "http://fastix.ru/api_v2/?apikey=%s&sub=getdirectlink&link=%s" % (api_key, pyfile.url) - page = self.load(url) + + page = self.load("http://fastix.ru/api_v2/", + get={'apikey': api_key, 'sub': "getdirectlink", 'link': pyfile.url}) data = json_loads(page) + self.logDebug("Json data", data) + if "error\":true" in page: self.offline() else: -- cgit v1.2.3 From 57300575fa97107d172e0c9909b244c8c8ae6c12 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 17 Dec 2014 20:02:20 +0100 Subject: Extend SimpleHoster in multi-hoster plugins --- module/plugins/hoster/FastixRu.py | 48 ++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 26 deletions(-) (limited to 'module/plugins/hoster/FastixRu.py') diff --git a/module/plugins/hoster/FastixRu.py b/module/plugins/hoster/FastixRu.py index 1e47638ea..a4e7338fe 100644 --- a/module/plugins/hoster/FastixRu.py +++ b/module/plugins/hoster/FastixRu.py @@ -6,10 +6,10 @@ from random import randrange from urllib import unquote from module.common.json_layer import json_loads -from module.plugins.Hoster import Hoster +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo -class FastixRu(Hoster): +class FastixRu(SimpleHoster): __name__ = "FastixRu" __type__ = "hoster" __version__ = "0.04" @@ -32,41 +32,34 @@ class FastixRu(Hoster): def setup(self): - self.chunkLimit = 3 + self.chunkLimit = 3 self.resumeDownload = True - def process(self, pyfile): - if re.match(self.__pattern__, pyfile.url): - new_url = pyfile.url - elif not self.account: - self.logError(_("Please enter your %s account or deactivate this plugin") % "Fastix") - self.fail(_("No Fastix account provided")) - else: - self.logDebug("Old URL: %s" % pyfile.url) - api_key = self.account.getAccountData(self.user) - api_key = api_key['api'] + def handleMulti(self): + api_key = self.account.getAccountData(self.user) + api_key = api_key['api'] - page = self.load("http://fastix.ru/api_v2/", - get={'apikey': api_key, 'sub': "getdirectlink", 'link': pyfile.url}) - data = json_loads(page) + page = self.load("http://fastix.ru/api_v2/", + get={'apikey': api_key, 'sub': "getdirectlink", 'link': self.pyfile.url}) + data = json_loads(page) - self.logDebug("Json data", data) + self.logDebug("Json data", data) - if "error\":true" in page: - self.offline() - else: - new_url = data['downloadlink'] + if "error\":true" in page: + self.offline() + else: + self.link = data['downloadlink'] - if new_url != pyfile.url: - self.logDebug("New URL: %s" % new_url) + if self.link != self.pyfile.url: + self.logDebug("New URL: %s" % self.link) - if pyfile.name.startswith("http") or pyfile.name.startswith("Unknown"): + if self.pyfile.name.startswith("http") or self.pyfile.name.startswith("Unknown"): #only use when name wasnt already set - pyfile.name = self.getFilename(new_url) + self.pyfile.name = self.getFilename(self.link) - self.download(new_url, disposition=True) + def checkFile(self): check = self.checkDownload({"error": "An error occurred while processing your request", "empty": re.compile(r"^$")}) @@ -74,3 +67,6 @@ class FastixRu(Hoster): self.retry(wait_time=60, reason=_("An error occurred while generating link")) elif check == "empty": self.retry(wait_time=60, reason=_("Downloaded File was empty")) + + +getInfo = create_getInfo(FastixRu) -- cgit v1.2.3 From 46f748a94ea5ab62ab0839ff0ce01e12e3eac688 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 17 Dec 2014 21:47:39 +0100 Subject: Extend SimpleHoster in multi-hoster plugins (2) --- module/plugins/hoster/FastixRu.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hoster/FastixRu.py') diff --git a/module/plugins/hoster/FastixRu.py b/module/plugins/hoster/FastixRu.py index a4e7338fe..379ac1cd4 100644 --- a/module/plugins/hoster/FastixRu.py +++ b/module/plugins/hoster/FastixRu.py @@ -12,7 +12,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class FastixRu(SimpleHoster): __name__ = "FastixRu" __type__ = "hoster" - __version__ = "0.04" + __version__ = "0.05" __pattern__ = r'http://(?:www\.)?fastix\.(ru|it)/file/(?P\w{24})' -- cgit v1.2.3 From 0860e09f5ff16ee3f097f6f9d444f277a38abd72 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 17 Dec 2014 23:03:46 +0100 Subject: Extend SimpleHoster in multi-hoster plugins (3) --- module/plugins/hoster/FastixRu.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'module/plugins/hoster/FastixRu.py') diff --git a/module/plugins/hoster/FastixRu.py b/module/plugins/hoster/FastixRu.py index 379ac1cd4..56d1e911a 100644 --- a/module/plugins/hoster/FastixRu.py +++ b/module/plugins/hoster/FastixRu.py @@ -21,6 +21,9 @@ class FastixRu(SimpleHoster): __authors__ = [("Massimo Rosamilia", "max@spiritix.eu")] + MULTI_HOSTER = True + + def getFilename(self, url): try: name = unquote(url.rsplit("/", 1)[1]) -- cgit v1.2.3 From 4e9c8f7ab1269966a9eac9e1b6363f5458f9f970 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Thu, 18 Dec 2014 16:07:21 +0100 Subject: Update checkFile routine in some hoster plugins --- module/plugins/hoster/FastixRu.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'module/plugins/hoster/FastixRu.py') diff --git a/module/plugins/hoster/FastixRu.py b/module/plugins/hoster/FastixRu.py index 56d1e911a..8778d770e 100644 --- a/module/plugins/hoster/FastixRu.py +++ b/module/plugins/hoster/FastixRu.py @@ -12,7 +12,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class FastixRu(SimpleHoster): __name__ = "FastixRu" __type__ = "hoster" - __version__ = "0.05" + __version__ = "0.06" __pattern__ = r'http://(?:www\.)?fastix\.(ru|it)/file/(?P\w{24})' @@ -63,13 +63,10 @@ class FastixRu(SimpleHoster): def checkFile(self): - check = self.checkDownload({"error": "An error occurred while processing your request", - "empty": re.compile(r"^$")}) + super(FastixRu, self).checkFile() - if check == "error": + if self.checkDownload({"error": "An error occurred while processing your request"}) is "error": self.retry(wait_time=60, reason=_("An error occurred while generating link")) - elif check == "empty": - self.retry(wait_time=60, reason=_("Downloaded File was empty")) getInfo = create_getInfo(FastixRu) -- cgit v1.2.3 From 87203e996fb42c172b15e29f0e394d5b328d9ac2 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 23 Dec 2014 13:20:53 +0100 Subject: New plugin: MultiHoster --- module/plugins/hoster/FastixRu.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'module/plugins/hoster/FastixRu.py') diff --git a/module/plugins/hoster/FastixRu.py b/module/plugins/hoster/FastixRu.py index 8778d770e..196b8479c 100644 --- a/module/plugins/hoster/FastixRu.py +++ b/module/plugins/hoster/FastixRu.py @@ -6,13 +6,13 @@ from random import randrange from urllib import unquote from module.common.json_layer import json_loads -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo -class FastixRu(SimpleHoster): +class FastixRu(MultiHoster): __name__ = "FastixRu" __type__ = "hoster" - __version__ = "0.06" + __version__ = "0.07" __pattern__ = r'http://(?:www\.)?fastix\.(ru|it)/file/(?P\w{24})' @@ -21,9 +21,6 @@ class FastixRu(SimpleHoster): __authors__ = [("Massimo Rosamilia", "max@spiritix.eu")] - MULTI_HOSTER = True - - def getFilename(self, url): try: name = unquote(url.rsplit("/", 1)[1]) -- cgit v1.2.3 From a4786e340993bbfc5d2bf971c9bec18863d3dd80 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 23 Dec 2014 19:29:15 +0100 Subject: [MultiHoster] Update --- module/plugins/hoster/FastixRu.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hoster/FastixRu.py') diff --git a/module/plugins/hoster/FastixRu.py b/module/plugins/hoster/FastixRu.py index 196b8479c..a4c85b4ca 100644 --- a/module/plugins/hoster/FastixRu.py +++ b/module/plugins/hoster/FastixRu.py @@ -12,7 +12,7 @@ from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo class FastixRu(MultiHoster): __name__ = "FastixRu" __type__ = "hoster" - __version__ = "0.07" + __version__ = "0.08" __pattern__ = r'http://(?:www\.)?fastix\.(ru|it)/file/(?P\w{24})' @@ -36,7 +36,7 @@ class FastixRu(MultiHoster): self.resumeDownload = True - def handleMulti(self): + def handlePremium(self): api_key = self.account.getAccountData(self.user) api_key = api_key['api'] -- cgit v1.2.3 From cdb06469a640c1875229903a2dbdfa8be469b5bc Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 27 Dec 2014 13:52:30 +0100 Subject: Improve a lot of plugin __pattern__ --- module/plugins/hoster/FastixRu.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hoster/FastixRu.py') diff --git a/module/plugins/hoster/FastixRu.py b/module/plugins/hoster/FastixRu.py index a4c85b4ca..5f6fd2d4c 100644 --- a/module/plugins/hoster/FastixRu.py +++ b/module/plugins/hoster/FastixRu.py @@ -14,7 +14,7 @@ class FastixRu(MultiHoster): __type__ = "hoster" __version__ = "0.08" - __pattern__ = r'http://(?:www\.)?fastix\.(ru|it)/file/(?P\w{24})' + __pattern__ = r'http://(?:www\.)?fastix\.(ru|it)/file/\w{24}' __description__ = """Fastix hoster plugin""" __license__ = "GPLv3" -- cgit v1.2.3