diff options
-rw-r--r-- | module/AccountManager.py | 33 | ||||
-rwxr-xr-x | module/network/Request.py | 7 | ||||
-rw-r--r-- | module/plugins/Account.py | 101 | ||||
-rw-r--r-- | module/plugins/Plugin.py | 10 | ||||
-rw-r--r-- | module/plugins/accounts/DepositfilesCom.py | 22 | ||||
-rw-r--r-- | module/plugins/accounts/FileserveCom.py | 34 | ||||
-rw-r--r-- | module/plugins/accounts/HotfileCom.py | 50 | ||||
-rw-r--r-- | module/plugins/accounts/MegauploadCom.py | 2 | ||||
-rw-r--r-- | module/plugins/accounts/NetloadIn.py | 2 | ||||
-rw-r--r-- | module/plugins/accounts/RapidshareCom.py | 57 | ||||
-rw-r--r-- | module/plugins/accounts/ShareonlineBiz.py | 23 | ||||
-rw-r--r-- | module/plugins/accounts/UploadedTo.py | 34 | ||||
-rw-r--r-- | module/plugins/hoster/NetloadIn.py | 6 | ||||
-rw-r--r-- | module/plugins/hoster/RapidshareCom.py | 2 | ||||
-rw-r--r-- | module/plugins/hoster/UploadedTo.py | 2 | ||||
-rw-r--r-- | module/web/templates/default/settings.html | 25 | ||||
-rwxr-xr-x | pyLoadCore.py | 1 |
17 files changed, 211 insertions, 200 deletions
diff --git a/module/AccountManager.py b/module/AccountManager.py index 46f573f68..6fdc7864d 100644 --- a/module/AccountManager.py +++ b/module/AccountManager.py @@ -41,8 +41,6 @@ class AccountManager(): self.loadAccounts() self.saveAccounts() # save to add categories to conf - - self.cachedAccountInfo = {} #---------------------------------------------------------------------- def getAccountPlugin(self, plugin): @@ -109,7 +107,7 @@ class AccountManager(): elif ":" in line: name, sep,pw = line.partition(":") - self.accounts[plugin][name] = {"password": pw, "options": []} + self.accounts[plugin][name] = {"password": pw, "options": [], "valid": True} @@ -144,13 +142,7 @@ class AccountManager(): if self.accounts.has_key(plugin): p = self.getAccountPlugin(plugin) p.updateAccounts(user, password, options) - - if self.accounts[plugin].has_key(user): - self.accounts[plugin][user]["password"] = password - self.accounts[plugin][user]["options"] = options - else: - self.accounts[plugin][user] = {"password": password, "options": options} - + self.saveAccounts() self.getAccountInfos(force=True) @@ -169,18 +161,17 @@ class AccountManager(): self.getAccountInfos(force=True) def getAccountInfos(self, force=False): - if not self.cachedAccountInfo: - self.cacheAccountInfos() - elif force: - self.core.scheduler.addJob(0, self.cacheAccountInfos, done=self.sendChange) - return self.cachedAccountInfo - - def cacheAccountInfos(self): - plugins = self.getAccountPlugins() data = {} - for p in plugins: - data[p.__name__] = p.getAllAccounts() - self.cachedAccountInfo = data + for p in self.accounts.keys(): + if self.accounts[p]: + p = self.getAccountPlugin(p) + data[p.__name__] = p.getAllAccounts(force) + else: + data[p] = {} + return data + + def cacheAccountInfos(self): + self.getAccountInfos() def sendChange(self): e = AccountUpdateEvent() diff --git a/module/network/Request.py b/module/network/Request.py index bbce37d6b..f5c856f6f 100755 --- a/module/network/Request.py +++ b/module/network/Request.py @@ -85,7 +85,8 @@ class Request: self.pycurl.setopt(pycurl.NOSIGNAL, 1) self.pycurl.setopt(pycurl.NOPROGRESS, 0) self.pycurl.setopt(pycurl.PROGRESSFUNCTION, self.progress) - self.pycurl.setopt(pycurl.AUTOREFERER, 1) + if hasattr(pycurl, "AUTOREFERER"): + self.pycurl.setopt(pycurl.AUTOREFERER, 1) self.pycurl.setopt(pycurl.HEADERFUNCTION, self.write_header) self.pycurl.setopt(pycurl.BUFFERSIZE, self.bufferSize) self.pycurl.setopt(pycurl.SSL_VERIFYPEER, 0) @@ -96,7 +97,7 @@ class Request: self.pycurl.setopt(pycurl.INTERFACE, self.interface) - self.pycurl.setopt(pycurl.USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en; rv:1.9.0.8) Gecko/2009032609 Firefox/3.0.10") + self.pycurl.setopt(pycurl.USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en; rv:1.9.2.10) Gecko/20100916 Firefox/3.6.10") if pycurl.version_info()[7]: self.pycurl.setopt(pycurl.ENCODING, "gzip, deflate") self.pycurl.setopt(pycurl.HTTPHEADER, ["Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8", @@ -267,7 +268,7 @@ class Request: else: self.updateCurrentSpeed(float(self.chunkRead/1024) / subTime) - self.subStartTime = time.time() + self.subStartTime += subTime # time.time() self.chunkRead = 0 if self.maxSpeed > 0: self.maxChunkSize = self.maxSpeed diff --git a/module/plugins/Account.py b/module/plugins/Account.py index f731eac17..5e86488d7 100644 --- a/module/plugins/Account.py +++ b/module/plugins/Account.py @@ -17,7 +17,7 @@ @author: mkaay """ -from random import randrange +from random import choice import re class Account(): @@ -32,71 +32,112 @@ class Account(): self.manager = manager self.core = manager.core self.accounts = {} - self.register = {} + self.infos = {} # cache for account information self.setAccounts(accounts) - + def login(self, user, data): pass - + + def _login(self, user, data): + try: + self.login(user, data) + except Exception, e: + self.core.log.warning(_("Could not login with account %s | %s") % (user, e)) + data["valid"] = False + if self.core.debug: + from traceback import print_exc + print_exc() + def setAccounts(self, accounts): self.accounts = accounts for user, data in self.accounts.iteritems(): - self.login(user, data) + self._login(user, data) def updateAccounts(self, user, password, options): if self.accounts.has_key(user): self.accounts[user]["password"] = password self.accounts[user]["options"] = options + self.accounts[user]["valid"] = True else: - self.accounts[user] = {"password" : password, "options": options} - - self.login(user, self.accounts[user]) + self.accounts[user] = {"password" : password, "options": options, "valid": True} + + self._login(user, self.accounts[user]) def removeAccount(self, user): if self.accounts.has_key(user): del self.accounts[user] + if self.infos.has_key(user): + del self.infos[user] - def getAccountInfo(self, name): + def getAccountInfo(self, name, force=False): + """ return dict with infos, do not overwrite this method! """ + data = Account.loadAccountInfo(self, name) + if not self.infos.has_key(name) or force: + self.core.log.debug("Get Account Info for %s" % name) + try: + infos = self.loadAccountInfo(name) + except Exception, e: + infos = {"error": str(e)} + self.core.log.debug("Account Info: %s" % str(infos)) + self.infos[name] = infos + data.update(infos) + return data + else: + data.update(self.infos[name]) + return data + + def loadAccountInfo(self, name): return { "validuntil": None, # -1 for unlimited "login": name, #"password": self.accounts[name]["password"], #@XXX: security "options": self.accounts[name]["options"], + "valid": self.accounts[name]["valid"], "trafficleft": None, # -1 for unlimited "maxtraffic": None, "type": self.__name__, } + + def getAllAccounts(self, force=False): + return [self.getAccountInfo(user, force) for user, data in self.accounts.iteritems()] - def getAllAccounts(self): - return [self.getAccountInfo(user) for user, data in self.accounts.iteritems()] - - def getAccountRequest(self, plugin): - user, data = self.getAccountData(plugin) + def getAccountRequest(self, user=None): + if not user: + user, data = self.selectAccount() req = self.core.requestFactory.getRequest(self.__name__, user) return req - - def getAccountData(self, plugin): - if not len(self.accounts): - return None - if not self.register.has_key(plugin): - account = self.selectAccount(plugin) - self.register[plugin] = account - else: - account = self.register[plugin] - return account - - def selectAccount(self, plugin): - account = self.accounts.items()[randrange(0, len(self.accounts), 1)] - return account + + def getAccountCookies(self, user=None): + if not user: + user, data = self.selectAccount() + cj = self.core.requestFactory.getCookieJar(self.__name__, user) + return cj + + def getAccountData(self, user): + return self.accounts[user] + + def selectAccount(self): + """ returns an valid and account name""" + usable = [] + for user,data in self.accounts: + if not data["valid"]: continue + for option, value in data["options"]: + pass + #@TODO comparate time option + + usable.append((user, data)) + + if not usable: return None + return choice(usable) def canUse(self): - return len(self.accounts) + return True if self.selectAccount() else False def parseTraffic(self, string): #returns kbyte string = string.strip().lower() p = re.compile(r"(\d+[\.,]\d+)(.*)") m = p.match(string) - if m: + if m: traffic = float(m.group(1).replace(",", ".")) unit = m.group(2).strip() if unit == "gb" or unit == "gig" or unit == "gbyte" or unit == "gigabyte": diff --git a/module/plugins/Plugin.py b/module/plugins/Plugin.py index 8009c8f01..af164c3a5 100644 --- a/module/plugins/Plugin.py +++ b/module/plugins/Plugin.py @@ -17,8 +17,6 @@ @author: RaNaN, spoob, mkaay """ -import logging - from time import time from time import sleep @@ -96,12 +94,13 @@ class Plugin(object): self.account = pyfile.m.core.accountManager.getAccountPlugin(self.__name__) # account handler instance if self.account and not self.account.canUse(): self.account = None if self.account: - self.req = self.account.getAccountRequest(self) + self.user, data = self.account.selectAccount() + self.req = self.account.getAccountRequest(self.user) #self.req.canContinue = True else: self.req = pyfile.m.core.requestFactory.getRequest(self.__name__) - self.log = logging.getLogger("log") + self.log = pyfile.m.core.log self.pyfile = pyfile self.thread = None # holds thread in future @@ -328,10 +327,11 @@ class Plugin(object): if api_size and api_size <= size: return None elif size > max_size: return None - + self.log.debug("Download Check triggered") f = open(self.lastDownload, "rb") content = f.read() f.close() + self.log.debug("Content: %s" % content) for name, rule in rules.iteritems(): if type(rule) in (str, unicode): if rule in content: diff --git a/module/plugins/accounts/DepositfilesCom.py b/module/plugins/accounts/DepositfilesCom.py index 1410e6a37..70741da0b 100644 --- a/module/plugins/accounts/DepositfilesCom.py +++ b/module/plugins/accounts/DepositfilesCom.py @@ -29,24 +29,18 @@ class DepositfilesCom(Account): __author_name__ = ("mkaay") __author_mail__ = ("mkaay@mkaay.de") - def getAccountInfo(self, user): - try: - req = self.core.requestFactory.getRequest(self.__name__, user) + def loadAccountInfo(self, user): + req = self.getAccountRequest(user) - src = req.load("http://depositfiles.com/de/gold/") - validuntil = re.search("noch den Gold-Zugriff: <b>(.*?)</b></div>", src).group(1) + src = req.load("http://depositfiles.com/de/gold/") + validuntil = re.search("noch den Gold-Zugriff: <b>(.*?)</b></div>", src).group(1) - validuntil = int(mktime(strptime(validuntil, "%Y-%m-%d %H:%M:%S"))) + validuntil = int(mktime(strptime(validuntil, "%Y-%m-%d %H:%M:%S"))) - out = Account.getAccountInfo(self, user) - - tmp = {"validuntil":validuntil, "trafficleft":-1} - out.update(tmp) - return out - except: - return Account.getAccountInfo(self, user) + tmp = {"validuntil":validuntil, "trafficleft":-1} + return tmp def login(self, user, data): - req = self.core.requestFactory.getRequest(self.__name__, user) + req = self.getAccountRequest(user) req.load("http://depositfiles.com/de/gold/payment.php") req.load("http://depositfiles.com/de/login.php", get={"return": "/de/gold/payment.php"}, post={"login": user, "password": data["password"]}) diff --git a/module/plugins/accounts/FileserveCom.py b/module/plugins/accounts/FileserveCom.py index 1fdb4c40b..27cad18bd 100644 --- a/module/plugins/accounts/FileserveCom.py +++ b/module/plugins/accounts/FileserveCom.py @@ -29,28 +29,22 @@ class FileserveCom(Account): __author_name__ = ("mkaay") __author_mail__ = ("mkaay@mkaay.de") - def getAccountInfo(self, user): - try: - req = self.core.requestFactory.getRequest(self.__name__, user) - - src = req.load("http://fileserve.com/dashboard.php", cookies=True) - - out = Account.getAccountInfo(self, user) - - m = re.search(r"<td><h4>Premium Until</h4></th> <td><h5>(.*?) E(.)T</h5></td>", src) - if m: - zone = -5 if m.group(2) == "S" else -4 - validuntil = int(mktime(strptime(m.group(1), "%d %B %Y"))) + 24*3600 + (zone*3600) - tmp = {"validuntil":validuntil, "trafficleft":-1} - else: - tmp = {"trafficleft":-1} - out.update(tmp) - return out - except: - return Account.getAccountInfo(self, user) + def loadAccountInfo(self, user): + req = self.getAccountRequest(user) + + src = req.load("http://fileserve.com/dashboard.php", cookies=True) + + m = re.search(r"<td><h4>Premium Until</h4></th> <td><h5>(.*?) E(.)T</h5></td>", src) + if m: + zone = -5 if m.group(2) == "S" else -4 + validuntil = int(mktime(strptime(m.group(1), "%d %B %Y"))) + 24*3600 + (zone*3600) + tmp = {"validuntil":validuntil, "trafficleft":-1} + else: + tmp = {"trafficleft":-1} + return tmp def login(self, user, data): - req = self.core.requestFactory.getRequest(self.__name__, user) + req = self.getAccountRequest(user) req.load("http://fileserve.com/login.php", post={"loginUserName": user, "loginUserPassword": data["password"], "autoLogin": "on", "loginFormSubmit": "Login"}, cookies=True) diff --git a/module/plugins/accounts/HotfileCom.py b/module/plugins/accounts/HotfileCom.py index 6b92df514..5a3fdd6a5 100644 --- a/module/plugins/accounts/HotfileCom.py +++ b/module/plugins/accounts/HotfileCom.py @@ -29,31 +29,25 @@ class HotfileCom(Account): __author_name__ = ("mkaay") __author_mail__ = ("mkaay@mkaay.de") - def getAccountInfo(self, user): - try: - req = self.core.requestFactory.getRequest(self.__name__, user) - - resp = self.apiCall("getuserinfo", user=user) - if resp.startswith("."): - self.core.debug("HotfileCom API Error: %s" % resp) - raise Exception - info = {} - for p in resp.split("&"): - key, value = p.split("=") - info[key] = value - - info["premium_until"] = info["premium_until"].replace("T"," ") - zone = info["premium_until"][19:] - info["premium_until"] = info["premium_until"][:19] - zone = int(zone[:3]) - - validuntil = int(mktime(strptime(info["premium_until"], "%Y-%m-%d %H:%M:%S"))) + (zone*3600) - out = Account.getAccountInfo(self, user) - tmp = {"validuntil":validuntil, "trafficleft":-1} - out.update(tmp) - return out - except: - return Account.getAccountInfo(self, user) + def loadAccountInfo(self, user): + resp = self.apiCall("getuserinfo", user=user) + if resp.startswith("."): + self.core.debug("HotfileCom API Error: %s" % resp) + raise Exception + info = {} + for p in resp.split("&"): + key, value = p.split("=") + info[key] = value + + info["premium_until"] = info["premium_until"].replace("T"," ") + zone = info["premium_until"][19:] + info["premium_until"] = info["premium_until"][:19] + zone = int(zone[:3]) + + validuntil = int(mktime(strptime(info["premium_until"], "%Y-%m-%d %H:%M:%S"))) + (zone*3600) + + tmp = {"validuntil":validuntil, "trafficleft":-1} + return tmp def apiCall(self, method, post={}, user=None): if user: @@ -64,7 +58,7 @@ class HotfileCom(Account): else: user, data = self.accounts.items()[0] - req = self.core.requestFactory.getRequest(self.__name__, user) + req = self.getAccountRequest(user) digest = req.load("http://api.hotfile.com/", post={"action":"getdigest"}) h = hashlib.md5() @@ -80,8 +74,8 @@ class HotfileCom(Account): return req.load("http://api.hotfile.com/", post=post) def login(self, user, data): - req = self.core.requestFactory.getRequest(self.__name__, user) - cj = self.core.requestFactory.getCookieJar(self.__name__, user) + req = self.getAccountRequest(user) + cj = self.getAccountCookies(user) cj.setCookie("hotfile.com", "lang", "en") req.load("http://hotfile.com/", cookies=True) req.load("http://hotfile.com/login.php", post={"returnto": "/", "user": user, "pass": data["password"]}, cookies=True) diff --git a/module/plugins/accounts/MegauploadCom.py b/module/plugins/accounts/MegauploadCom.py index 36779d4f5..77a11fe25 100644 --- a/module/plugins/accounts/MegauploadCom.py +++ b/module/plugins/accounts/MegauploadCom.py @@ -28,5 +28,5 @@ class MegauploadCom(Account): __author_mail__ = ("RaNaN@pyload.org") def login(self, user, data): - req = self.core.requestFactory.getRequest(self.__name__, user) + req = self.getAccountRequest(user) req.load("http://www.megaupload.com/?c=login&next=c%3Dpremium", post={ "username" : user, "password" : data["password"], "login" :"1"}, cookies=True) diff --git a/module/plugins/accounts/NetloadIn.py b/module/plugins/accounts/NetloadIn.py index 5743c7835..28b3a1c56 100644 --- a/module/plugins/accounts/NetloadIn.py +++ b/module/plugins/accounts/NetloadIn.py @@ -28,6 +28,6 @@ class NetloadIn(Account): __author_mail__ = ("RaNaN@pyload.org") def login(self, user, data): - req = self.core.requestFactory.getRequest(self.__name__, user) + req = self.getAccountRequest(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 c9766cd57..ccc0d0fb2 100644 --- a/module/plugins/accounts/RapidshareCom.py +++ b/module/plugins/accounts/RapidshareCom.py @@ -27,44 +27,35 @@ class RapidshareCom(Account): __author_name__ = ("mkaay") __author_mail__ = ("mkaay@mkaay.de") - def getAccountInfo(self, user): - try: - data = None - for account in self.accounts.items(): - if account[0] == user: - data = account[1] - if not data: - raise Exception - 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"): - raise Exception - fields = src.split("\n") - info = {} - for t in fields: - if not t.strip(): - continue - k, v = t.split("=") - info[k] = v - - out = Account.getAccountInfo(self, user) - restkb = int(info["tskb"]) - maxtraffic = int(info["rapids"])/14 * (5*1024*1024) + restkb - tmp = {"validuntil":int(info["billeduntil"]), "trafficleft":maxtraffic if int(info["autorefill"]) else restkb, "maxtraffic":maxtraffic} - out.update(tmp) - return out - except: - return Account.getAccountInfo(self, user) + def loadAccountInfo(self, user): + data = self.getAccountData(user) + req = self.getAccountRequest(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"): + raise Exception(src) + fields = src.split("\n") + info = {} + for t in fields: + if not t.strip(): + continue + k, v = t.split("=") + info[k] = v + + restkb = int(info["tskb"]) + maxtraffic = int(info["rapids"])/14 * (5*1024*1024) + restkb + tmp = {"validuntil":int(info["billeduntil"]), "trafficleft":maxtraffic if int(info["autorefill"]) else restkb, "maxtraffic":maxtraffic} + + return tmp def login(self, user, data): - req = self.core.requestFactory.getRequest(self.__name__, user) + req = self.getAccountRequest(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 + raise Exception(src) fields = src.split("\n") info = {} for t in fields: @@ -72,7 +63,7 @@ class RapidshareCom(Account): continue k, v = t.split("=") info[k] = v - cj = self.core.requestFactory.getCookieJar(self.__name__, user) + cj = self.getAccountCookies(user) cj.setCookie("rapidshare.com", "enc", info["cookie"]) diff --git a/module/plugins/accounts/ShareonlineBiz.py b/module/plugins/accounts/ShareonlineBiz.py index 2eb78bf43..e7405c659 100644 --- a/module/plugins/accounts/ShareonlineBiz.py +++ b/module/plugins/accounts/ShareonlineBiz.py @@ -29,22 +29,17 @@ class ShareonlineBiz(Account): __author_name__ = ("mkaay") __author_mail__ = ("mkaay@mkaay.de") - def getAccountInfo(self, user): - try: - req = self.core.requestFactory.getRequest(self.__name__, user) - src = req.load("http://www.share-online.biz/alpha/lang/set/english") - validuntil = re.search(r"Account valid till:.*?<span class='.*?'>(.*?)</span>", src, re.S).group(1) - validuntil = int(mktime(strptime(validuntil, "%m/%d/%Y, %I:%M:%S %p"))) - - out = Account.getAccountInfo(self, user) - tmp = {"validuntil":validuntil, "trafficleft":-1} - out.update(tmp) - return out - except: - return Account.getAccountInfo(self, user) + def loadAccountInfo(self, user): + req = self.getAccountRequest(user) + src = req.load("http://www.share-online.biz/alpha/lang/set/english") + validuntil = re.search(r"Account valid till:.*?<span class='.*?'>(.*?)</span>", src, re.S).group(1) + validuntil = int(mktime(strptime(validuntil, "%m/%d/%Y, %I:%M:%S %p"))) + + tmp = {"validuntil":validuntil, "trafficleft":-1} + return tmp def login(self, user, data): - req = self.core.requestFactory.getRequest(self.__name__, user) + req = self.getAccountRequest(user) post_vars = {"user": user, "pass": data["password"], "l_rememberme":"1"} diff --git a/module/plugins/accounts/UploadedTo.py b/module/plugins/accounts/UploadedTo.py index 99141f20a..a783d9154 100644 --- a/module/plugins/accounts/UploadedTo.py +++ b/module/plugins/accounts/UploadedTo.py @@ -29,27 +29,17 @@ class UploadedTo(Account): __author_name__ = ("mkaay") __author_mail__ = ("mkaay@mkaay.de") - def getAccountInfo(self, user): - try: - data = None - for account in self.accounts.items(): - if account[0] == user: - data = account[1] - if not data: - raise Exception - req = self.core.requestFactory.getRequest(self.__name__, user) - html = req.load("http://uploaded.to/?setlang=en", cookies=True) - raw_traffic = re.search(r"Traffic left: </span><span class=.*?>(.*?)</span>", html).group(1) - 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"))) - out = Account.getAccountInfo(self, user) - tmp = {"validuntil":validuntil, "trafficleft":traffic, "maxtraffic":100*1024*1024} - out.update(tmp) - return out - except: - return Account.getAccountInfo(self, user) - + def loadAccountInfo(self, user): + req = self.getAccountRequest(user) + html = req.load("http://uploaded.to/?setlang=en", cookies=True) + raw_traffic = re.search(r"Traffic left: </span><span class=.*?>(.*?)</span>", html).group(1) + 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"))) + + tmp = {"validuntil":validuntil, "trafficleft":traffic, "maxtraffic":100*1024*1024} + return tmp + def login(self, user, data): - req = self.core.requestFactory.getRequest(self.__name__, user) + req = self.getAccountRequest() req.load("http://uploaded.to/login", post={ "email" : user, "password" : data["password"]}, cookies=True) diff --git a/module/plugins/hoster/NetloadIn.py b/module/plugins/hoster/NetloadIn.py index 2a1053fae..369cd9189 100644 --- a/module/plugins/hoster/NetloadIn.py +++ b/module/plugins/hoster/NetloadIn.py @@ -226,3 +226,9 @@ class NetloadIn(Hoster): self.download(url, cookies=True) + check = self.checkDownload({"empty": re.compile(r"^$")}) + + if check == "empty": + self.log.info(_("Downloaded File was empty")) + self.retry() + diff --git a/module/plugins/hoster/RapidshareCom.py b/module/plugins/hoster/RapidshareCom.py index f7ee287bc..8123f5a65 100644 --- a/module/plugins/hoster/RapidshareCom.py +++ b/module/plugins/hoster/RapidshareCom.py @@ -149,7 +149,7 @@ class RapidshareCom(Hoster): def handlePremium(self): - info = self.account.getAccountInfo(self.account.getAccountData(self)[0]) + info = self.account.getAccountInfo(self.user, True) self.log.debug(_("%(name)s: Use Premium Account (%(left)sGB left)") % { "name" : self.__name__, "left": info["trafficleft"]/1000/1000 }) if self.api_data["size"] / 1024 > info["trafficleft"]: self.log.info(_("%s: Not enough traffic left" % self.__name__)) diff --git a/module/plugins/hoster/UploadedTo.py b/module/plugins/hoster/UploadedTo.py index 70d71b493..933feab39 100644 --- a/module/plugins/hoster/UploadedTo.py +++ b/module/plugins/hoster/UploadedTo.py @@ -64,7 +64,7 @@ class UploadedTo(Hoster): # self.pyfile.name = self.get_file_name() if self.account: - info = self.account.getAccountInfo(self.account.getAccountData(self)[0]) + info = self.account.getAccountInfo(self.user, True) self.log.debug(_("%(name)s: Use Premium Account (%(left)sGB left)") % {"name" :self.__name__, "left" : info["trafficleft"]/1024/1024}) if self.api_data["size"]/1024 > info["trafficleft"]: self.log.info(_("%s: Not enough traffic left" % self.__name__)) diff --git a/module/web/templates/default/settings.html b/module/web/templates/default/settings.html index f1ade3a84..a4d3ceb25 100644 --- a/module/web/templates/default/settings.html +++ b/module/web/templates/default/settings.html @@ -135,11 +135,26 @@ <td> <input id="{{plugin}}|delete;{{account.login}}" name="{{configname}}|{{plugin}}|password;{{account.login}}" type="password" value="{{account.password}}"/> </td> - <td> - {% trans "Delete? " %} - <input id="{{plugin}}|delete;{{account.login}}" name="{{configname}}|{{plugin}}|delete;{{account.login}}" type="checkbox" value="True"/> - - </td> + <td> + {% trans "Status:" %} + {% if account.valid %} + {% trans "valid" %} + {% else %} + {% trans "not valid" %} + {% endif %} + |</td> + <td> + {% trans "Valid until:" %} + {{ account.validuntil }} + |</td> + <td> + {% trans "Traffic left:" %} + {{ account.trafficleft }} + |</td> + <td> + {% trans "Delete? " %} + <input id="{{plugin}}|delete;{{account.login}}" name="{{configname}}|{{plugin}}|delete;{{account.login}}" type="checkbox" value="True"/> + </td> </tr> {% endfor %} diff --git a/pyLoadCore.py b/pyLoadCore.py index 072737716..9f2e2ab91 100755 --- a/pyLoadCore.py +++ b/pyLoadCore.py @@ -308,7 +308,6 @@ class Core(object): f = open(link_file, "wb") f.close() - #self.scheduler.start() self.scheduler.addJob(0, self.accountManager.cacheAccountInfos) while True: |