summaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
authorGravatar mkaay <mkaay@mkaay.de> 2010-08-12 00:51:10 +0200
committerGravatar mkaay <mkaay@mkaay.de> 2010-08-12 00:51:10 +0200
commitbc12e7c71cc93bcc22f80dba15111091b4528e03 (patch)
tree96b5204ec3ba1c2db53ca809fb909f0f4518fab0 /module
parentmerge (diff)
downloadpyload-bc12e7c71cc93bcc22f80dba15111091b4528e03.tar.xz
account plugin change, server methods for accounts
Diffstat (limited to 'module')
-rw-r--r--module/plugins/Account.py14
-rw-r--r--module/plugins/accounts/NetloadIn.py9
-rw-r--r--module/plugins/accounts/RapidshareCom.py33
-rw-r--r--module/plugins/accounts/ShareonlineBiz.py15
-rw-r--r--module/plugins/accounts/UploadedTo.py7
-rw-r--r--module/plugins/hoster/ShareonlineBiz.py6
6 files changed, 45 insertions, 39 deletions
diff --git a/module/plugins/Account.py b/module/plugins/Account.py
index 3b18e563f..de5fb00d6 100644
--- a/module/plugins/Account.py
+++ b/module/plugins/Account.py
@@ -35,12 +35,20 @@ class Account():
self.register = {}
self.setAccounts(accounts)
- def login(self):
+ def login(self, user, data):
pass
def setAccounts(self, accounts):
self.accounts = accounts
- self.login()
+ for user, data in self.accounts:
+ self.login(user, data)
+
+ def updateAccounts(self, user, password):
+ self.accounts[user]["password"] if self.accounts.has_key(user) else self.accounts[user] = {"password":password}
+ self.login(user, self.accounts[user])
+
+ def removeAccount(self, user):
+ del self.accounts[user]
def getAccountInfo(self, name):
return {
@@ -51,7 +59,7 @@ class Account():
}
def getAllAccounts(self):
- pass
+ return [self.getAccountInfo(user) for user, data in self.accounts.iteritems()]
def getAccountRequest(self, plugin):
user, data = self.getAccountData(plugin)
diff --git a/module/plugins/accounts/NetloadIn.py b/module/plugins/accounts/NetloadIn.py
index e0f66e269..5743c7835 100644
--- a/module/plugins/accounts/NetloadIn.py
+++ b/module/plugins/accounts/NetloadIn.py
@@ -27,8 +27,7 @@ class NetloadIn(Account):
__author_name__ = ("RaNaN")
__author_mail__ = ("RaNaN@pyload.org")
- def login(self):
- for user, data in self.accounts.items():
- req = self.core.requestFactory.getRequest(self.__name__, user)
- req.load("http://netload.in/index.php", None, { "txtuser" : user, "txtpass" : data['password'], "txtcheck" : "login", "txtlogin" : ""}, cookies=True)
- \ No newline at end of file
+ def login(self, user, data):
+ req = self.core.requestFactory.getRequest(self.__name__, user)
+ req.load("http://netload.in/index.php", None, { "txtuser" : user, "txtpass" : data['password'], "txtcheck" : "login", "txtlogin" : ""}, cookies=True)
+
diff --git a/module/plugins/accounts/RapidshareCom.py b/module/plugins/accounts/RapidshareCom.py
index c0974dab4..233cd9801 100644
--- a/module/plugins/accounts/RapidshareCom.py
+++ b/module/plugins/accounts/RapidshareCom.py
@@ -51,22 +51,21 @@ class RapidshareCom(Account):
return out
- def login(self):
- for user, data in self.accounts.items():
- req = self.core.requestFactory.getRequest(self.__name__, user)
- api_url_base = "http://api.rapidshare.com/cgi-bin/rsapi.cgi"
- api_param_prem = {"sub": "getaccountdetails_v1", "type": "prem", "login": user, "password": data["password"], "withcookie": 1}
- src = req.load(api_url_base, cookies=False, get=api_param_prem)
- if src.startswith("ERROR"):
- return
- fields = src.split("\n")
- info = {}
- for t in fields:
- if not t.strip():
- continue
- k, v = t.split("=")
- info[k] = v
- cj = self.core.requestFactory.getCookieJar(self.__name__, user)
- cj.setCookie("rapidshare.com", "enc", info["cookie"])
+ def login(self, user, data):
+ req = self.core.requestFactory.getRequest(self.__name__, user)
+ api_url_base = "http://api.rapidshare.com/cgi-bin/rsapi.cgi"
+ api_param_prem = {"sub": "getaccountdetails_v1", "type": "prem", "login": user, "password": data["password"], "withcookie": 1}
+ src = req.load(api_url_base, cookies=False, get=api_param_prem)
+ if src.startswith("ERROR"):
+ return
+ fields = src.split("\n")
+ info = {}
+ for t in fields:
+ if not t.strip():
+ continue
+ k, v = t.split("=")
+ info[k] = v
+ cj = self.core.requestFactory.getCookieJar(self.__name__, user)
+ cj.setCookie("rapidshare.com", "enc", info["cookie"])
diff --git a/module/plugins/accounts/ShareonlineBiz.py b/module/plugins/accounts/ShareonlineBiz.py
index fa5cc362c..69a8ddc0c 100644
--- a/module/plugins/accounts/ShareonlineBiz.py
+++ b/module/plugins/accounts/ShareonlineBiz.py
@@ -29,11 +29,10 @@ class ShareonlineBiz(Account):
#@TODO: account info
- def login(self):
- for user, data in self.accounts.items():
- req = self.core.requestFactory.getRequest(self.__name__, user)
- post_vars = {"user": user,
- "pass": data["password"],
- "l_rememberme":"1"}
- req.lastURL = "http://www.share-online.biz/alpha/"
- req.load("https://www.share-online.biz/alpha/user/login", cookies=True, post=post_vars)
+ def login(self, user, data):
+ req = self.core.requestFactory.getRequest(self.__name__, user)
+ post_vars = {"user": user,
+ "pass": data["password"],
+ "l_rememberme":"1"}
+ req.lastURL = "http://www.share-online.biz/alpha/"
+ req.load("https://www.share-online.biz/alpha/user/login", cookies=True, post=post_vars)
diff --git a/module/plugins/accounts/UploadedTo.py b/module/plugins/accounts/UploadedTo.py
index 9521f2577..242e6cd5e 100644
--- a/module/plugins/accounts/UploadedTo.py
+++ b/module/plugins/accounts/UploadedTo.py
@@ -44,7 +44,6 @@ class UploadedTo(Account):
validuntil = int(mktime(strptime(raw_valid.strip(), "%d-%m-%Y %H:%M")))
return {"login":user, "validuntil":validuntil, "trafficleft":traffic, "type":self.__name__}
- def login(self):
- for user, data in self.accounts.items():
- req = self.core.requestFactory.getRequest(self.__name__, user)
- req.load("http://uploaded.to/login", None, { "email" : user, "password" : data["password"]}, cookies=True)
+ def login(self, user, data):
+ req = self.core.requestFactory.getRequest(self.__name__, user)
+ req.load("http://uploaded.to/login", None, { "email" : user, "password" : data["password"]}, cookies=True)
diff --git a/module/plugins/hoster/ShareonlineBiz.py b/module/plugins/hoster/ShareonlineBiz.py
index 7958de794..8646fcc88 100644
--- a/module/plugins/hoster/ShareonlineBiz.py
+++ b/module/plugins/hoster/ShareonlineBiz.py
@@ -20,10 +20,12 @@ def getInfo(urls):
src = getURL(api_url_base, post=api_param_file)
result = []
for i, res in enumerate(src.split("\n")):
+ if not res:
+ continue
fields = res.split(";")
- status = 2 if self.api_data["status"] == "OK" else 3
+ status = 2 if fields[1] == "OK" else 3
result.append((fields[2], int(fields[3]), status, urls[i]))
- return result
+ yield result
class ShareonlineBiz(Hoster):
__name__ = "ShareonlineBiz"