summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar mkaay <mkaay@mkaay.de> 2010-05-07 17:50:26 +0200
committerGravatar mkaay <mkaay@mkaay.de> 2010-05-07 17:50:26 +0200
commit58f36fc058e6f566ecffc395f09419f34ece50a9 (patch)
tree65bdc68d6110fc371446c99685dabb18156a1f0d
parentUploadedTo account plugin (diff)
downloadpyload-58f36fc058e6f566ecffc395f09419f34ece50a9.tar.xz
new server method for premium accounts
-rw-r--r--module/PluginManager.py3
-rw-r--r--module/plugins/Account.py8
-rw-r--r--module/plugins/accounts/RapidshareCom.py2
-rw-r--r--module/plugins/accounts/UploadedTo.py2
-rwxr-xr-xpyLoadCore.py7
5 files changed, 18 insertions, 4 deletions
diff --git a/module/PluginManager.py b/module/PluginManager.py
index fb3948639..a91acefe3 100644
--- a/module/PluginManager.py
+++ b/module/PluginManager.py
@@ -105,5 +105,8 @@ class PluginManager():
return plugin
return None
+ def getAccountPlugins(self):
+ return self.accountPlugins
+
def getHookPlugins(self):
return self.hookPlugins
diff --git a/module/plugins/Account.py b/module/plugins/Account.py
index 2ed2325c9..7c8beec76 100644
--- a/module/plugins/Account.py
+++ b/module/plugins/Account.py
@@ -43,10 +43,14 @@ class Account():
def getAccountInfo(self, name):
return {
"validuntil": None,
- "login": None,
- "trafficleft": None
+ "login": name,
+ "trafficleft": None,
+ "type": self.__name__
}
+ def getAllAccounts(self):
+ return map(lambda t: self.getAccountInfo(t[0]), self.accounts)
+
def getAccountRequest(self, plugin):
account = self.getAccountData(plugin)
req = self.core.requestFactory.getRequest(self.__name__, account[0])
diff --git a/module/plugins/accounts/RapidshareCom.py b/module/plugins/accounts/RapidshareCom.py
index c9113afd7..f494b17be 100644
--- a/module/plugins/accounts/RapidshareCom.py
+++ b/module/plugins/accounts/RapidshareCom.py
@@ -47,7 +47,7 @@ class RapidshareCom(Account):
continue
k, v = t.split("=")
info[k] = v
- out = {"validuntil":int(info["validuntil"]), "login":str(info["accountid"]), "trafficleft":int(info["premkbleft"])}
+ out = {"validuntil":int(info["validuntil"]), "login":str(info["accountid"]), "trafficleft":int(info["premkbleft"]), "type":self.__name__}
if int(info["plustrafficmode"]) == 1 or int(info["plustrafficmode"]) == 3:
out["trafficleft"] += int(info["bodkb"])
if int(info["plustrafficmode"]) == 2 or int(info["plustrafficmode"]) == 3:
diff --git a/module/plugins/accounts/UploadedTo.py b/module/plugins/accounts/UploadedTo.py
index 9c0d90747..a56082657 100644
--- a/module/plugins/accounts/UploadedTo.py
+++ b/module/plugins/accounts/UploadedTo.py
@@ -42,7 +42,7 @@ class UploadedTo(Account):
raw_valid = re.search(r"Valid until: </span> <span class=.*?>(.*?)</span>", html).group(1)
traffic = int(self.parseTraffic(raw_traffic))
validuntil = int(mktime(strptime(raw_valid.strip(), "%d-%m-%Y %H:%M")))
- return {"login":name, "validuntil":validuntil, "trafficleft":traffic}
+ return {"login":name, "validuntil":validuntil, "trafficleft":traffic, "type":self.__name__}
def login(self):
for account in self.accounts:
diff --git a/pyLoadCore.py b/pyLoadCore.py
index 394dfcf32..259f8fbe0 100755
--- a/pyLoadCore.py
+++ b/pyLoadCore.py
@@ -760,6 +760,13 @@ class ServerMethods():
data.append(p)
return data
+ def get_premium_accounts(self):
+ plugins = self.core.pluginManager.getAccountPlugins()
+ data = []
+ for p in plugins:
+ data.extend(p.getAllAccounts())
+ return data
+
#def move_urls_up(self, ids):
# for id in ids:
# self.core.file_list.move(id)