summaryrefslogtreecommitdiffstats
path: root/module/plugins/hoster/NoPremiumPl.py
diff options
context:
space:
mode:
Diffstat (limited to 'module/plugins/hoster/NoPremiumPl.py')
-rw-r--r--module/plugins/hoster/NoPremiumPl.py58
1 files changed, 30 insertions, 28 deletions
diff --git a/module/plugins/hoster/NoPremiumPl.py b/module/plugins/hoster/NoPremiumPl.py
index c3313c525..9e2a5a93c 100644
--- a/module/plugins/hoster/NoPremiumPl.py
+++ b/module/plugins/hoster/NoPremiumPl.py
@@ -7,10 +7,12 @@ from module.plugins.internal.MultiHoster import MultiHoster
class NoPremiumPl(MultiHoster):
__name__ = "NoPremiumPl"
__type__ = "hoster"
- __version__ = "0.02"
+ __version__ = "0.04"
+ __status__ = "testing"
__pattern__ = r'https?://direct\.nopremium\.pl.+'
- __config__ = [("use_premium", "bool", "Use premium account if available", True)]
+ __config__ = [("use_premium" , "bool", "Use premium account if available" , True),
+ ("revertfailed", "bool", "Revert to standard download if fails", True)]
__description__ = """NoPremium.pl multi-hoster plugin"""
__license__ = "GPLv3"
@@ -37,68 +39,68 @@ class NoPremiumPl(MultiHoster):
def prepare(self):
super(NoPremiumPl, self).prepare()
- data = self.account.getAccountData(self.user)
+ data = self.account.get_data(self.user)
self.usr = data['usr']
self.pwd = data['pwd']
- def runFileQuery(self, url, mode=None):
+ def run_file_query(self, url, mode=None):
query = self.API_QUERY.copy()
- query["username"] = self.usr
- query["password"] = self.pwd
- query["url"] = url
+ query['username'] = self.usr
+ query['password'] = self.pwd
+ query['url'] = url
if mode == "fileinfo":
query['check'] = 2
query['loc'] = 1
- self.logDebug(query)
+ self.log_debug(query)
return self.load(self.API_URL, post=query)
- def handleFree(self, pyfile):
+ def handle_free(self, pyfile):
try:
- data = self.runFileQuery(pyfile.url, 'fileinfo')
+ data = self.run_file_query(pyfile.url, 'fileinfo')
except Exception:
- self.logDebug("runFileQuery error")
- self.tempOffline()
+ self.log_debug("runFileQuery error")
+ self.temp_offline()
try:
parsed = json_loads(data)
except Exception:
- self.logDebug("loads error")
- self.tempOffline()
+ self.log_debug("loads error")
+ self.temp_offline()
- self.logDebug(parsed)
+ self.log_debug(parsed)
if "errno" in parsed.keys():
- if parsed["errno"] in self.ERROR_CODES:
- # error code in known
- self.fail(self.ERROR_CODES[parsed["errno"]] % self.__name__)
+ if parsed['errno'] in self.ERROR_CODES:
+ #: Error code in known
+ self.fail(self.ERROR_CODES[parsed['errno']] % self.__name__)
else:
- # error code isn't yet added to plugin
+ #: Error code isn't yet added to plugin
self.fail(
- parsed["errstring"]
- or _("Unknown error (code: %s)") % parsed["errno"]
+ parsed['errstring']
+ or _("Unknown error (code: %s)") % parsed['errno']
)
if "sdownload" in parsed:
- if parsed["sdownload"] == "1":
+ if parsed['sdownload'] == "1":
self.fail(
_("Download from %s is possible only using NoPremium.pl website \
- directly") % parsed["hosting"])
+ directly") % parsed['hosting'])
- pyfile.name = parsed["filename"]
- pyfile.size = parsed["filesize"]
+ pyfile.name = parsed['filename']
+ pyfile.size = parsed['filesize']
try:
- self.link = self.runFileQuery(pyfile.url, 'filedownload')
+ self.link = self.run_file_query(pyfile.url, 'filedownload')
except Exception:
- self.logDebug("runFileQuery error #2")
- self.tempOffline()
+ self.log_debug("runFileQuery error #2")
+ self.temp_offline()