From d09306aa1f9103141e7fc7c4e72588bf46be71da Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 27 Dec 2014 13:49:50 +0100 Subject: [SimplyPremiumCom] Fixup --- module/plugins/hoster/SimplyPremiumCom.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'module/plugins/hoster/SimplyPremiumCom.py') diff --git a/module/plugins/hoster/SimplyPremiumCom.py b/module/plugins/hoster/SimplyPremiumCom.py index 87ccb317e..bf7c43af6 100644 --- a/module/plugins/hoster/SimplyPremiumCom.py +++ b/module/plugins/hoster/SimplyPremiumCom.py @@ -5,15 +5,15 @@ import re from datetime import datetime, timedelta from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo -from module.plugins.hoster.UnrestrictLi import secondsToMidnight +from module.plugins.internal.SimpleHoster import secondsToMidnight class SimplyPremiumCom(MultiHoster): __name__ = "SimplyPremiumCom" __type__ = "hoster" - __version__ = "0.06" + __version__ = "0.07" - __pattern__ = r'https?://.*(simply-premium)\.com' + __pattern__ = r'https?://.+simply-premium\.com' __description__ = """Simply-Premium.com hoster plugin""" __license__ = "GPLv3" @@ -49,7 +49,7 @@ class SimplyPremiumCom(MultiHoster): elif "trafficlimit" in page: self.logWarning(_("Reached daily limit for this host")) - self.retry(wait_time=secondsToMidnight(gmt=2), "Daily limit for this host reached") + self.retry(wait_time=secondsToMidnight(gmt=2), reason="Daily limit for this host reached") elif "hostererror" in page: self.logWarning(_("Hoster temporarily unavailable, waiting 1 minute and retry")) -- cgit v1.2.3 From ea58af3c625d90aec6becfd943289e42e4a71a9a Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 2 Jan 2015 02:49:26 +0100 Subject: Code cosmetics --- module/plugins/hoster/SimplyPremiumCom.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'module/plugins/hoster/SimplyPremiumCom.py') diff --git a/module/plugins/hoster/SimplyPremiumCom.py b/module/plugins/hoster/SimplyPremiumCom.py index bf7c43af6..fe38cff6e 100644 --- a/module/plugins/hoster/SimplyPremiumCom.py +++ b/module/plugins/hoster/SimplyPremiumCom.py @@ -21,8 +21,7 @@ class SimplyPremiumCom(MultiHoster): def setup(self): - self.chunkLimit = 16 - self.resumeDownload = False + self.chunkLimit = 16 def handlePremium(self): -- cgit v1.2.3 From fd105f8e51768ec1943cda2375bdfdbe5b0a3951 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 9 Jan 2015 00:35:51 +0100 Subject: "New Year" Update: hoster plugins --- module/plugins/hoster/SimplyPremiumCom.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'module/plugins/hoster/SimplyPremiumCom.py') diff --git a/module/plugins/hoster/SimplyPremiumCom.py b/module/plugins/hoster/SimplyPremiumCom.py index fe38cff6e..39e8a6aeb 100644 --- a/module/plugins/hoster/SimplyPremiumCom.py +++ b/module/plugins/hoster/SimplyPremiumCom.py @@ -11,11 +11,11 @@ from module.plugins.internal.SimpleHoster import secondsToMidnight class SimplyPremiumCom(MultiHoster): __name__ = "SimplyPremiumCom" __type__ = "hoster" - __version__ = "0.07" + __version__ = "0.08" __pattern__ = r'https?://.+simply-premium\.com' - __description__ = """Simply-Premium.com hoster plugin""" + __description__ = """Simply-Premium.com multi-hoster plugin""" __license__ = "GPLv3" __authors__ = [("EvolutionClip", "evolutionclip@live.de")] @@ -24,7 +24,7 @@ class SimplyPremiumCom(MultiHoster): self.chunkLimit = 16 - def handlePremium(self): + def handlePremium(self, pyfile): for i in xrange(5): page = self.load("http://www.simply-premium.com/premium.php", get={'info': "", 'link': self.pyfile.url}) self.logDebug("JSON data: " + page) -- cgit v1.2.3 From b25bc61dd47d8d3c42969bd0f72443b21c4b059e Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 8 Feb 2015 02:09:45 +0100 Subject: Spare code cosmetics --- module/plugins/hoster/SimplyPremiumCom.py | 53 +++++++++++++++++-------------- 1 file changed, 29 insertions(+), 24 deletions(-) (limited to 'module/plugins/hoster/SimplyPremiumCom.py') diff --git a/module/plugins/hoster/SimplyPremiumCom.py b/module/plugins/hoster/SimplyPremiumCom.py index 39e8a6aeb..a87e7533f 100644 --- a/module/plugins/hoster/SimplyPremiumCom.py +++ b/module/plugins/hoster/SimplyPremiumCom.py @@ -24,53 +24,58 @@ class SimplyPremiumCom(MultiHoster): self.chunkLimit = 16 - def handlePremium(self, pyfile): - for i in xrange(5): - page = self.load("http://www.simply-premium.com/premium.php", get={'info': "", 'link': self.pyfile.url}) - self.logDebug("JSON data: " + page) - if page != '': - break - else: - self.logInfo(_("Unable to get API data, waiting 1 minute and retry")) - self.retry(5, 60, "Unable to get API data") - - if '0' in page or ( - "You are not allowed to download from this host" in page and self.premium): + def checkErrors(self): + if '0' in self.html or ( + "You are not allowed to download from this host" in self.html and self.premium): self.account.relogin(self.user) self.retry() - elif "NOTFOUND" in page: + elif "NOTFOUND" in self.html: self.offline() - elif "downloadlimit" in page: + elif "downloadlimit" in self.html: self.logWarning(_("Reached maximum connctions")) - self.retry(5, 60, "Reached maximum connctions") + self.retry(5, 60, _("Reached maximum connctions")) - elif "trafficlimit" in page: + elif "trafficlimit" in self.html: self.logWarning(_("Reached daily limit for this host")) self.retry(wait_time=secondsToMidnight(gmt=2), reason="Daily limit for this host reached") - elif "hostererror" in page: + elif "hostererror" in self.html: self.logWarning(_("Hoster temporarily unavailable, waiting 1 minute and retry")) - self.retry(5, 60, "Hoster is temporarily unavailable") + self.retry(5, 60, _("Hoster is temporarily unavailable")) + + + def handlePremium(self, pyfile): + for i in xrange(5): + self.html = self.load("http://www.simply-premium.com/premium.php", get={'info': "", 'link': self.pyfile.url}) + + if self.html: + self.logDebug("JSON data: " + self.html) + break + else: + self.logInfo(_("Unable to get API data, waiting 1 minute and retry")) + self.retry(5, 60, _("Unable to get API data")) + + self.checkErrors() try: - self.pyfile.name = re.search(r'([^<]+)', page).group(1) + self.pyfile.name = re.search(r'([^<]+)', self.html).group(1) + except AttributeError: self.pyfile.name = "" try: - self.pyfile.size = re.search(r'(\d+)', page).group(1) + self.pyfile.size = re.search(r'(\d+)', self.html).group(1) + except AttributeError: self.pyfile.size = 0 try: - self.link = re.search(r'([^<]+)', page).group(1) + self.link = re.search(r'([^<]+)', self.html).group(1) + except AttributeError: self.link = 'http://www.simply-premium.com/premium.php?link=' + self.pyfile.url - if self.link != self.pyfile.url: - self.logDebug("New URL: " + self.link) - getInfo = create_getInfo(SimplyPremiumCom) -- cgit v1.2.3 From e65d19ee3a1e435bf2896ed829e5581eeef92dd2 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 14 Mar 2015 11:07:54 +0100 Subject: Import cleanup for datetime and time modules --- module/plugins/hoster/SimplyPremiumCom.py | 2 -- 1 file changed, 2 deletions(-) (limited to 'module/plugins/hoster/SimplyPremiumCom.py') diff --git a/module/plugins/hoster/SimplyPremiumCom.py b/module/plugins/hoster/SimplyPremiumCom.py index a87e7533f..978aba11a 100644 --- a/module/plugins/hoster/SimplyPremiumCom.py +++ b/module/plugins/hoster/SimplyPremiumCom.py @@ -2,8 +2,6 @@ import re -from datetime import datetime, timedelta - from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo from module.plugins.internal.SimpleHoster import secondsToMidnight -- cgit v1.2.3 From 7d90803262ccbb4fc5296a4dc3ce30fe98f55631 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 25 Mar 2015 23:10:07 +0100 Subject: __config__ cosmetics --- module/plugins/hoster/SimplyPremiumCom.py | 1 + 1 file changed, 1 insertion(+) (limited to 'module/plugins/hoster/SimplyPremiumCom.py') diff --git a/module/plugins/hoster/SimplyPremiumCom.py b/module/plugins/hoster/SimplyPremiumCom.py index 978aba11a..b3f52bc8c 100644 --- a/module/plugins/hoster/SimplyPremiumCom.py +++ b/module/plugins/hoster/SimplyPremiumCom.py @@ -12,6 +12,7 @@ class SimplyPremiumCom(MultiHoster): __version__ = "0.08" __pattern__ = r'https?://.+simply-premium\.com' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Simply-Premium.com multi-hoster plugin""" __license__ = "GPLv3" -- cgit v1.2.3