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/LinksnappyCom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hoster/LinksnappyCom.py') diff --git a/module/plugins/hoster/LinksnappyCom.py b/module/plugins/hoster/LinksnappyCom.py index 2ed7744d7..3de19945b 100644 --- a/module/plugins/hoster/LinksnappyCom.py +++ b/module/plugins/hoster/LinksnappyCom.py @@ -34,7 +34,7 @@ class LinksnappyCom(Hoster): json_params = json_dumps({'link': pyfile.url, 'type': host, 'username': self.user, - 'password': self.account.getAccountData(self.user)["password"]}) + 'password': self.account.getAccountData(self.user)['password']}) r = self.load('http://gen.linksnappy.com/genAPI.php', post={'genLinks': json_params}) self.logDebug("JSON data: " + r) -- 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/LinksnappyCom.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'module/plugins/hoster/LinksnappyCom.py') diff --git a/module/plugins/hoster/LinksnappyCom.py b/module/plugins/hoster/LinksnappyCom.py index 3de19945b..e4200e9f2 100644 --- a/module/plugins/hoster/LinksnappyCom.py +++ b/module/plugins/hoster/LinksnappyCom.py @@ -1,23 +1,27 @@ # -*- coding: utf-8 -*- import re + from urlparse import urlsplit -from module.plugins.Hoster import Hoster from module.common.json_layer import json_loads, json_dumps +from module.plugins.Hoster import Hoster class LinksnappyCom(Hoster): __name__ = "LinksnappyCom" - __version__ = "0.02" __type__ = "hoster" + __version__ = "0.02" + __pattern__ = r'https?://(?:[^/]*\.)?linksnappy\.com' + __description__ = """Linksnappy.com hoster plugin""" __author_name__ = "stickell" __author_mail__ = "l.stickell@yahoo.it" SINGLE_CHUNK_HOSTERS = ('easybytez.com') + def setup(self): self.chunkLimit = -1 self.resumeDownload = True -- 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/LinksnappyCom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hoster/LinksnappyCom.py') diff --git a/module/plugins/hoster/LinksnappyCom.py b/module/plugins/hoster/LinksnappyCom.py index e4200e9f2..c6862cbd2 100644 --- a/module/plugins/hoster/LinksnappyCom.py +++ b/module/plugins/hoster/LinksnappyCom.py @@ -46,7 +46,7 @@ class LinksnappyCom(Hoster): j = json_loads(r)['links'][0] if j['error']: - self.logError('Error converting the link: %s' % j['error']) + self.logError("Error converting the link: %s" % j['error']) self.fail('Error converting the link') pyfile.name = j['filename'] -- 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/LinksnappyCom.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hoster/LinksnappyCom.py') diff --git a/module/plugins/hoster/LinksnappyCom.py b/module/plugins/hoster/LinksnappyCom.py index c6862cbd2..3685fb238 100644 --- a/module/plugins/hoster/LinksnappyCom.py +++ b/module/plugins/hoster/LinksnappyCom.py @@ -16,8 +16,8 @@ class LinksnappyCom(Hoster): __pattern__ = r'https?://(?:[^/]*\.)?linksnappy\.com' __description__ = """Linksnappy.com hoster plugin""" - __author_name__ = "stickell" - __author_mail__ = "l.stickell@yahoo.it" + __authors__ = [("stickell", "l.stickell@yahoo.it")] + SINGLE_CHUNK_HOSTERS = ('easybytez.com') -- 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/LinksnappyCom.py | 1 + 1 file changed, 1 insertion(+) (limited to 'module/plugins/hoster/LinksnappyCom.py') diff --git a/module/plugins/hoster/LinksnappyCom.py b/module/plugins/hoster/LinksnappyCom.py index 3685fb238..3372a505d 100644 --- a/module/plugins/hoster/LinksnappyCom.py +++ b/module/plugins/hoster/LinksnappyCom.py @@ -16,6 +16,7 @@ class LinksnappyCom(Hoster): __pattern__ = r'https?://(?:[^/]*\.)?linksnappy\.com' __description__ = """Linksnappy.com hoster plugin""" + __license__ = "GPLv3" __authors__ = [("stickell", "l.stickell@yahoo.it")] -- 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/LinksnappyCom.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'module/plugins/hoster/LinksnappyCom.py') diff --git a/module/plugins/hoster/LinksnappyCom.py b/module/plugins/hoster/LinksnappyCom.py index 3372a505d..b96c9492c 100644 --- a/module/plugins/hoster/LinksnappyCom.py +++ b/module/plugins/hoster/LinksnappyCom.py @@ -27,6 +27,7 @@ class LinksnappyCom(Hoster): self.chunkLimit = -1 self.resumeDownload = True + def process(self, pyfile): if re.match(self.__pattern__, pyfile.url): new_url = pyfile.url @@ -67,6 +68,7 @@ class LinksnappyCom(Hoster): if check == "html302": self.retry(wait_time=5, reason="Linksnappy returns only HTML data.") + @staticmethod def _get_host(url): host = urlsplit(url).netloc -- cgit v1.2.3 From e3f5280529921100f48bb8a79853bf480c7611e4 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 25 Oct 2014 02:53:05 +0200 Subject: Replace single quotes with doubles in self.error and self.fail msg --- module/plugins/hoster/LinksnappyCom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hoster/LinksnappyCom.py') diff --git a/module/plugins/hoster/LinksnappyCom.py b/module/plugins/hoster/LinksnappyCom.py index b96c9492c..3c417a9d3 100644 --- a/module/plugins/hoster/LinksnappyCom.py +++ b/module/plugins/hoster/LinksnappyCom.py @@ -49,7 +49,7 @@ class LinksnappyCom(Hoster): if j['error']: self.logError("Error converting the link: %s" % j['error']) - self.fail('Error converting the link') + self.fail("Error converting the link") pyfile.name = j['filename'] new_url = j['generated'] -- 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/LinksnappyCom.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'module/plugins/hoster/LinksnappyCom.py') diff --git a/module/plugins/hoster/LinksnappyCom.py b/module/plugins/hoster/LinksnappyCom.py index 3c417a9d3..512f55686 100644 --- a/module/plugins/hoster/LinksnappyCom.py +++ b/module/plugins/hoster/LinksnappyCom.py @@ -33,7 +33,7 @@ class LinksnappyCom(Hoster): new_url = pyfile.url elif not self.account: self.logError(_("Please enter your %s account or deactivate this plugin") % "Linksnappy.com") - self.fail("No Linksnappy.com account provided") + self.fail(_("No Linksnappy.com account provided")) else: self.logDebug("Old URL: %s" % pyfile.url) host = self._get_host(pyfile.url) @@ -48,8 +48,9 @@ class LinksnappyCom(Hoster): j = json_loads(r)['links'][0] if j['error']: - self.logError("Error converting the link: %s" % j['error']) - self.fail("Error converting the link") + msg = _("Error converting the link") + self.logError(msg, j['error']) + self.fail(msg) pyfile.name = j['filename'] new_url = j['generated'] @@ -66,7 +67,7 @@ class LinksnappyCom(Hoster): check = self.checkDownload({"html302": "302 Found"}) if check == "html302": - self.retry(wait_time=5, reason="Linksnappy returns only HTML data.") + self.retry(wait_time=5, reason="Linksnappy returns only HTML data") @staticmethod -- 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/LinksnappyCom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hoster/LinksnappyCom.py') diff --git a/module/plugins/hoster/LinksnappyCom.py b/module/plugins/hoster/LinksnappyCom.py index 512f55686..b7d4632b6 100644 --- a/module/plugins/hoster/LinksnappyCom.py +++ b/module/plugins/hoster/LinksnappyCom.py @@ -67,7 +67,7 @@ class LinksnappyCom(Hoster): check = self.checkDownload({"html302": "302 Found"}) if check == "html302": - self.retry(wait_time=5, reason="Linksnappy returns only HTML data") + self.retry(wait_time=5, reason=_("Linksnappy returns only HTML data")) @staticmethod -- 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/LinksnappyCom.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'module/plugins/hoster/LinksnappyCom.py') diff --git a/module/plugins/hoster/LinksnappyCom.py b/module/plugins/hoster/LinksnappyCom.py index b7d4632b6..b8694e141 100644 --- a/module/plugins/hoster/LinksnappyCom.py +++ b/module/plugins/hoster/LinksnappyCom.py @@ -9,15 +9,15 @@ from module.plugins.Hoster import Hoster class LinksnappyCom(Hoster): - __name__ = "LinksnappyCom" - __type__ = "hoster" + __name__ = "LinksnappyCom" + __type__ = "hoster" __version__ = "0.02" __pattern__ = r'https?://(?:[^/]*\.)?linksnappy\.com' __description__ = """Linksnappy.com hoster plugin""" - __license__ = "GPLv3" - __authors__ = [("stickell", "l.stickell@yahoo.it")] + __license__ = "GPLv3" + __authors__ = [("stickell", "l.stickell@yahoo.it")] SINGLE_CHUNK_HOSTERS = ('easybytez.com') -- 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/LinksnappyCom.py | 63 ++++++++++++++++------------------ 1 file changed, 30 insertions(+), 33 deletions(-) (limited to 'module/plugins/hoster/LinksnappyCom.py') diff --git a/module/plugins/hoster/LinksnappyCom.py b/module/plugins/hoster/LinksnappyCom.py index b8694e141..1f97fab31 100644 --- a/module/plugins/hoster/LinksnappyCom.py +++ b/module/plugins/hoster/LinksnappyCom.py @@ -5,10 +5,10 @@ import re from urlparse import urlsplit from module.common.json_layer import json_loads, json_dumps -from module.plugins.Hoster import Hoster +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo -class LinksnappyCom(Hoster): +class LinksnappyCom(SimpleHoster): __name__ = "LinksnappyCom" __type__ = "hoster" __version__ = "0.02" @@ -24,48 +24,42 @@ class LinksnappyCom(Hoster): def setup(self): - self.chunkLimit = -1 + self.chunkLimit = -1 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") % "Linksnappy.com") - self.fail(_("No Linksnappy.com account provided")) - else: - self.logDebug("Old URL: %s" % pyfile.url) - host = self._get_host(pyfile.url) - json_params = json_dumps({'link': pyfile.url, - 'type': host, - 'username': self.user, - 'password': self.account.getAccountData(self.user)['password']}) - r = self.load('http://gen.linksnappy.com/genAPI.php', - post={'genLinks': json_params}) - self.logDebug("JSON data: " + r) + def handleMulti(self): + host = self._get_host(self.pyfile.url) + json_params = json_dumps({'link': self.pyfile.url, + 'type': host, + 'username': self.user, + 'password': self.account.getAccountData(self.user)['password']}) + r = self.load('http://gen.linksnappy.com/genAPI.php', + post={'genLinks': json_params}) + self.logDebug("JSON data: " + r) - j = json_loads(r)['links'][0] + j = json_loads(r)['links'][0] - if j['error']: - msg = _("Error converting the link") - self.logError(msg, j['error']) - self.fail(msg) + if j['error']: + msg = _("Error converting the link") + self.logError(msg, j['error']) + self.fail(msg) - pyfile.name = j['filename'] - new_url = j['generated'] + self.pyfile.name = j['filename'] + self.link = j['generated'] - if host in self.SINGLE_CHUNK_HOSTERS: - self.chunkLimit = 1 - else: - self.setup() + if host in self.SINGLE_CHUNK_HOSTERS: + self.chunkLimit = 1 + else: + self.setup() - if new_url != pyfile.url: - self.logDebug("New URL: " + new_url) + if self.link != self.pyfile.url: + self.logDebug("New URL: " + self.link) - self.download(new_url, disposition=True) + def checkFile(self): check = self.checkDownload({"html302": "302 Found"}) + if check == "html302": self.retry(wait_time=5, reason=_("Linksnappy returns only HTML data")) @@ -74,3 +68,6 @@ class LinksnappyCom(Hoster): def _get_host(url): host = urlsplit(url).netloc return re.search(r'[\w-]+\.\w+$', host).group(0) + + +getInfo = create_getInfo(LinksnappyCom) -- 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/LinksnappyCom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hoster/LinksnappyCom.py') diff --git a/module/plugins/hoster/LinksnappyCom.py b/module/plugins/hoster/LinksnappyCom.py index 1f97fab31..878e4222b 100644 --- a/module/plugins/hoster/LinksnappyCom.py +++ b/module/plugins/hoster/LinksnappyCom.py @@ -11,7 +11,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class LinksnappyCom(SimpleHoster): __name__ = "LinksnappyCom" __type__ = "hoster" - __version__ = "0.02" + __version__ = "0.03" __pattern__ = r'https?://(?:[^/]*\.)?linksnappy\.com' -- 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/LinksnappyCom.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'module/plugins/hoster/LinksnappyCom.py') diff --git a/module/plugins/hoster/LinksnappyCom.py b/module/plugins/hoster/LinksnappyCom.py index 878e4222b..c7bce407e 100644 --- a/module/plugins/hoster/LinksnappyCom.py +++ b/module/plugins/hoster/LinksnappyCom.py @@ -20,6 +20,8 @@ class LinksnappyCom(SimpleHoster): __authors__ = [("stickell", "l.stickell@yahoo.it")] + MULTI_HOSTER = True + SINGLE_CHUNK_HOSTERS = ('easybytez.com') -- 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/LinksnappyCom.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'module/plugins/hoster/LinksnappyCom.py') diff --git a/module/plugins/hoster/LinksnappyCom.py b/module/plugins/hoster/LinksnappyCom.py index c7bce407e..376b6d093 100644 --- a/module/plugins/hoster/LinksnappyCom.py +++ b/module/plugins/hoster/LinksnappyCom.py @@ -11,7 +11,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class LinksnappyCom(SimpleHoster): __name__ = "LinksnappyCom" __type__ = "hoster" - __version__ = "0.03" + __version__ = "0.04" __pattern__ = r'https?://(?:[^/]*\.)?linksnappy\.com' @@ -60,6 +60,8 @@ class LinksnappyCom(SimpleHoster): def checkFile(self): + super(LinksnappyCom, self).checkFile() + check = self.checkDownload({"html302": "302 Found"}) if check == "html302": -- 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/LinksnappyCom.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'module/plugins/hoster/LinksnappyCom.py') diff --git a/module/plugins/hoster/LinksnappyCom.py b/module/plugins/hoster/LinksnappyCom.py index 376b6d093..ff63f2c32 100644 --- a/module/plugins/hoster/LinksnappyCom.py +++ b/module/plugins/hoster/LinksnappyCom.py @@ -5,13 +5,13 @@ import re from urlparse import urlsplit from module.common.json_layer import json_loads, json_dumps -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo -class LinksnappyCom(SimpleHoster): +class LinksnappyCom(MultiHoster): __name__ = "LinksnappyCom" __type__ = "hoster" - __version__ = "0.04" + __version__ = "0.05" __pattern__ = r'https?://(?:[^/]*\.)?linksnappy\.com' @@ -20,8 +20,6 @@ class LinksnappyCom(SimpleHoster): __authors__ = [("stickell", "l.stickell@yahoo.it")] - MULTI_HOSTER = True - SINGLE_CHUNK_HOSTERS = ('easybytez.com') -- 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/LinksnappyCom.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hoster/LinksnappyCom.py') diff --git a/module/plugins/hoster/LinksnappyCom.py b/module/plugins/hoster/LinksnappyCom.py index ff63f2c32..90a47d1ac 100644 --- a/module/plugins/hoster/LinksnappyCom.py +++ b/module/plugins/hoster/LinksnappyCom.py @@ -11,7 +11,7 @@ from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo class LinksnappyCom(MultiHoster): __name__ = "LinksnappyCom" __type__ = "hoster" - __version__ = "0.05" + __version__ = "0.06" __pattern__ = r'https?://(?:[^/]*\.)?linksnappy\.com' @@ -28,7 +28,7 @@ class LinksnappyCom(MultiHoster): self.resumeDownload = True - def handleMulti(self): + def handlePremium(self): host = self._get_host(self.pyfile.url) json_params = json_dumps({'link': self.pyfile.url, 'type': host, -- cgit v1.2.3