From 0072668fd976f9ce4dbaac7e807791f21cbe07ed Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 6 Jul 2014 18:57:55 +0200 Subject: Compute wait time using secondsToMidnight --- module/plugins/hoster/SimplyPremiumCom.py | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) (limited to 'module/plugins/hoster/SimplyPremiumCom.py') diff --git a/module/plugins/hoster/SimplyPremiumCom.py b/module/plugins/hoster/SimplyPremiumCom.py index 17060e00d..dcd97d1e3 100644 --- a/module/plugins/hoster/SimplyPremiumCom.py +++ b/module/plugins/hoster/SimplyPremiumCom.py @@ -19,22 +19,12 @@ import re from datetime import datetime, timedelta from module.plugins.Hoster import Hoster - - -def secondsToMidnight(): - # Seconds until 00:10 GMT+2 - now = datetime.utcnow() + timedelta(hours=2) - if now.hour is 0 and now.minute < 10: - midnight = now - else: - midnight = now + timedelta(days=1) - midnight = midnight.replace(hour=0, minute=10, second=0, microsecond=0) - return int((midnight - now).total_seconds()) +from module.plugins.hoster.UnrestrictLi import secondsToMidnight class SimplyPremiumCom(Hoster): __name__ = "SimplyPremiumCom" - __version__ = "0.02" + __version__ = "0.03" __type__ = "hoster" __pattern__ = r"https?://.*(simply-premium)\.com" __description__ = """Simply-Premium.Com hoster plugin""" @@ -69,13 +59,13 @@ class SimplyPremiumCom(Hoster): elif "NOTFOUND" in page: self.offline() elif "downloadlimit" in page: - self.logInfo("Reached maximum connctions") + self.logWarning("Reached maximum connctions") self.retry(5, 60, "Reached maximum connctions") elif "trafficlimit" in page: - self.logInfo("Reached daily limit for this host. Waiting until 00:10 GMT+2") - self.retry(5, secondsToMidnight(), "Daily limit for this host reached") + self.logWarning("Reached daily limit for this host") + self.retry(1, secondsToMidnight(gmt=2), "Daily limit for this host reached") elif "hostererror" in page: - self.logInfo("Hoster temporarily unavailable, waiting 1 minute and retry") + self.logWarning("Hoster temporarily unavailable, waiting 1 minute and retry") self.retry(5, 60, "Hoster is temporarily unavailable") #page = json_loads(page) #new_url = page.keys()[0] -- cgit v1.2.3 From 5060e4c6374a5116d0d8b02528f910f8c5f8bcf9 Mon Sep 17 00:00:00 2001 From: Walter Purcaro 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/SimplyPremiumCom.py | 5 ++--- 1 file changed, 2 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 dcd97d1e3..c0be4b145 100644 --- a/module/plugins/hoster/SimplyPremiumCom.py +++ b/module/plugins/hoster/SimplyPremiumCom.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - ############################################################################ # This program is free software: you can redistribute it and/or modify # # it under the terms of the GNU Affero General Public License as # @@ -26,8 +25,8 @@ class SimplyPremiumCom(Hoster): __name__ = "SimplyPremiumCom" __version__ = "0.03" __type__ = "hoster" - __pattern__ = r"https?://.*(simply-premium)\.com" - __description__ = """Simply-Premium.Com hoster plugin""" + __pattern__ = r'https?://.*(simply-premium)\.com' + __description__ = """Simply-Premium.com hoster plugin""" __author_name__ = "EvolutionClip" __author_mail__ = "evolutionclip@live.de" -- 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/SimplyPremiumCom.py | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) (limited to 'module/plugins/hoster/SimplyPremiumCom.py') diff --git a/module/plugins/hoster/SimplyPremiumCom.py b/module/plugins/hoster/SimplyPremiumCom.py index c0be4b145..5db9f5daa 100644 --- a/module/plugins/hoster/SimplyPremiumCom.py +++ b/module/plugins/hoster/SimplyPremiumCom.py @@ -1,20 +1,7 @@ # -*- coding: utf-8 -*- -############################################################################ -# This program is free software: you can redistribute it and/or modify # -# it under the terms of the GNU Affero General Public License as # -# published by the Free Software Foundation, either version 3 of the # -# License, or (at your option) any later version. # -# # -# This program is distributed in the hope that it will be useful, # -# but WITHOUT ANY WARRANTY; without even the implied warranty of # -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # -# GNU Affero General Public License for more details. # -# # -# You should have received a copy of the GNU Affero General Public License # -# along with this program. If not, see . # -############################################################################ import re + from datetime import datetime, timedelta from module.plugins.Hoster import Hoster @@ -23,13 +10,16 @@ from module.plugins.hoster.UnrestrictLi import secondsToMidnight class SimplyPremiumCom(Hoster): __name__ = "SimplyPremiumCom" - __version__ = "0.03" __type__ = "hoster" + __version__ = "0.03" + __pattern__ = r'https?://.*(simply-premium)\.com' + __description__ = """Simply-Premium.com hoster plugin""" __author_name__ = "EvolutionClip" __author_mail__ = "evolutionclip@live.de" + def setup(self): self.chunkLimit = 16 self.resumeDownload = False -- cgit v1.2.3