summaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-10-22 02:52:44 +0200
committerGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-10-22 02:52:44 +0200
commited8b4014eb9971504b775b61ace6fa3208ee6463 (patch)
tree57f355406b48c77d1535ec225795525aab975091 /module
parent[SimpleCrypter] Fix https://github.com/pyload/pyload/issues/2094 (diff)
downloadpyload-ed8b4014eb9971504b775b61ace6fa3208ee6463.tar.xz
[Account] Add method 'setup'
Diffstat (limited to 'module')
-rw-r--r--module/plugins/internal/Account.py56
1 files changed, 32 insertions, 24 deletions
diff --git a/module/plugins/internal/Account.py b/module/plugins/internal/Account.py
index 211ad7fb3..1c03f0b1c 100644
--- a/module/plugins/internal/Account.py
+++ b/module/plugins/internal/Account.py
@@ -12,8 +12,8 @@ from module.plugins.internal.utils import compare_time, isiterable, lock, parse_
class Account(Plugin):
__name__ = "Account"
__type__ = "account"
- __version__ = "0.64"
- __status__ = "testing"
+ __version__ = "0.65"
+ __status__ = "stable"
__description__ = """Base account plugin"""
__license__ = "GPLv3"
@@ -44,6 +44,35 @@ class Account(Plugin):
self.init()
+ @property
+ def logged(self):
+ """
+ Checks if user is still logged in
+ """
+ if not self.user:
+ return False
+
+ self.sync()
+
+ if self.info['login']['timestamp'] + self.timeout < time.time():
+ self.log_debug("Reached login timeout for user `%s`" % self.user)
+ return False
+ else:
+ return True
+
+
+ @property
+ def premium(self):
+ return bool(self.get_data('premium'))
+
+
+ def setup(self):
+ """
+ Setup for enviroment and other things, called before logging (possibly more than one time)
+ """
+ pass
+
+
def set_interval(self, value):
newinterval = max(0, self.PERIODICAL_INTERVAL, value)
@@ -90,28 +119,6 @@ class Account(Plugin):
raise NotImplementedError
- @property
- def logged(self):
- """
- Checks if user is still logged in
- """
- if not self.user:
- return False
-
- self.sync()
-
- if self.info['login']['timestamp'] + self.timeout < time.time():
- self.log_debug("Reached login timeout for user `%s`" % self.user)
- return False
- else:
- return True
-
-
- @property
- def premium(self):
- return bool(self.get_data('premium'))
-
-
def signin(self, user, password, data):
"""
Login into account, the cookies will be saved so user can be recognized
@@ -129,6 +136,7 @@ class Account(Plugin):
self.req = self.pyload.requestFactory.getRequest(self.classname, self.user)
self.sync()
+ self.setup()
timestamp = time.time()