summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--module/PluginThread.py5
-rw-r--r--module/plugins/Account.py21
-rw-r--r--module/plugins/Plugin.py3
-rw-r--r--module/plugins/accounts/ShareonlineBiz.py7
-rw-r--r--module/plugins/hoster/ShareonlineBiz.py6
5 files changed, 29 insertions, 13 deletions
diff --git a/module/PluginThread.py b/module/PluginThread.py
index 2acd04e53..71089482f 100644
--- a/module/PluginThread.py
+++ b/module/PluginThread.py
@@ -134,9 +134,8 @@ class PluginThread(Thread):
except Exception, e:
dump += "<ERROR WHILE PRINTING VALUE> " + str(e) + "\n"
- if pyfile.pluginname in self.m.core.config.values.keys():
- dump += "\n\nCONFIG: \n\n"
- dump += pformat(self.m.core.config.values[pyfile.pluginname]) + "\n"
+ dump += "\n\nCONFIG: \n\n"
+ dump += pformat(self.m.core.config.values) + "\n"
return dump
diff --git a/module/plugins/Account.py b/module/plugins/Account.py
index 9da8d0357..363af3d8b 100644
--- a/module/plugins/Account.py
+++ b/module/plugins/Account.py
@@ -72,15 +72,20 @@ class Account(Base, AccountInfo):
def init(self):
pass
+ #TODO: remove user, data
def login(self, user, data, req):
"""login into account, the cookies will be saved so user can be recognized
- :param user: loginname
- :param data: data dictionary
+ :param user: Deprecated
+ :param data: Deprecated
:param req: `Request` instance
"""
raise NotImplemented
+ def relogin(self):
+ """ Force a login, same as `_login` """
+ return self._login()
+
@lock
def _login(self):
# set timestamp for login
@@ -106,6 +111,8 @@ class Account(Base, AccountInfo):
finally:
req.close()
+ return self.valid
+
def restoreDefaults(self):
self.valid = Account.valid
self.validuntil = Account.validuntil
@@ -173,6 +180,16 @@ class Account(Base, AccountInfo):
else:
self.logDebug("Unknown attribute %s=%s" % (k, v))
+ #TODO: remove user
+ def loadAccountInfo(self, user, req):
+ """ Overwrite this method and set account attributes within this method.
+
+ :param user: Deprecated
+ :param req: Request instance
+ :return:
+ """
+ pass
+
def isPremium(self, user=None):
if user: self.logDebug("Deprecated Argument user for .isPremium()", user)
return self.premium
diff --git a/module/plugins/Plugin.py b/module/plugins/Plugin.py
index d78eb162b..3cfb89c21 100644
--- a/module/plugins/Plugin.py
+++ b/module/plugins/Plugin.py
@@ -134,7 +134,8 @@ class Plugin(Base):
self.thread = thread
if self.account:
- self.account.checkLogin()
+ # will force a relogin or reload of account info if necessary
+ self.account.getAccountInfo()
else:
self.req.clearCookies()
diff --git a/module/plugins/accounts/ShareonlineBiz.py b/module/plugins/accounts/ShareonlineBiz.py
index 4ecd7e1c2..4dd398d6d 100644
--- a/module/plugins/accounts/ShareonlineBiz.py
+++ b/module/plugins/accounts/ShareonlineBiz.py
@@ -29,9 +29,8 @@ class ShareonlineBiz(Account):
__author_name__ = ("mkaay")
__author_mail__ = ("mkaay@mkaay.de")
- def getUserAPI(self, user, req):
- data = self.getAccountData(user)
- src = req.load("http://api.share-online.biz/account.php?username=%s&password=%s&act=userDetails" % (user, data["password"]))
+ def getUserAPI(self, req):
+ src = req.load("http://api.share-online.biz/account.php?username=%s&password=%s&act=userDetails" % (self.loginname, self.password))
info = {}
for line in src.splitlines():
key, value = line.split("=")
@@ -40,7 +39,7 @@ class ShareonlineBiz(Account):
def loadAccountInfo(self, user, req):
try:
- info = self.getUserAPI(user, req)
+ info = self.getUserAPI(req)
return {"validuntil": int(info["expire_date"]), "trafficleft": -1, "premium": not info["group"] == "Sammler"}
except:
pass
diff --git a/module/plugins/hoster/ShareonlineBiz.py b/module/plugins/hoster/ShareonlineBiz.py
index d355eeffe..641a9b025 100644
--- a/module/plugins/hoster/ShareonlineBiz.py
+++ b/module/plugins/hoster/ShareonlineBiz.py
@@ -52,7 +52,7 @@ class ShareonlineBiz(Hoster):
self.multiDL = False
self.chunkLimit = 1
- if self.account and self.account.isPremium(self.user):
+ if self.premium:
self.multiDL = True
def process(self, pyfile):
@@ -60,7 +60,7 @@ class ShareonlineBiz(Hoster):
pyfile.name = self.api_data["filename"]
pyfile.sync()
- if self.account and self.account.isPremium(self.user):
+ if self.premium:
self.handleAPIPremium()
#self.handleWebsitePremium()
else:
@@ -127,7 +127,7 @@ class ShareonlineBiz(Hoster):
def handleAPIPremium(self): #should be working better
self.resumeDownload = True
- info = self.account.getUserAPI(self.user, self.req)
+ info = self.account.getUserAPI(self.req)
if info["dl"].lower() == "not_available":
self.fail("DL API error")
self.req.cj.setCookie("share-online.biz", "dl", info["dl"])