diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2011-02-22 20:38:45 +0100 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2011-02-22 20:38:45 +0100 |
commit | 3b0f78439f70ede5dd0c24af39d7eb1b79b1446c (patch) | |
tree | a5946290c13a3e85fc4e1e67493fd0f26ba9fff9 | |
parent | NCryptIn: Bug fixes (diff) | |
download | pyload-3b0f78439f70ede5dd0c24af39d7eb1b79b1446c.tar.xz |
filesonic info prefetching + premium fix
-rw-r--r-- | module/CaptchaManager.py | 2 | ||||
-rw-r--r-- | module/PluginThread.py | 5 | ||||
-rw-r--r-- | module/plugins/accounts/FilesonicCom.py | 7 | ||||
-rw-r--r-- | module/plugins/hoster/FilesonicCom.py | 17 | ||||
-rw-r--r-- | module/remote/RemoteManager.py | 4 | ||||
-rw-r--r-- | module/web/webinterface.py | 52 |
6 files changed, 37 insertions, 50 deletions
diff --git a/module/CaptchaManager.py b/module/CaptchaManager.py index 1520bb1b9..8296fb9c6 100644 --- a/module/CaptchaManager.py +++ b/module/CaptchaManager.py @@ -63,7 +63,7 @@ class CaptchaManager(): if cli: #client connected -> should solve the captcha self.tasks.append(task) - task.setWaiting(40) #wait 40 sec for response + task.setWaiting(50) #wait 50 sec for response for plugin in self.core.hookManager.activePlugins(): try: diff --git a/module/PluginThread.py b/module/PluginThread.py index b99589154..75ed7e5b9 100644 --- a/module/PluginThread.py +++ b/module/PluginThread.py @@ -445,6 +445,7 @@ class InfoThread(PluginThread): try: self.m.core.log.debug("Run Info Fetching for %s" % pluginname) for result in plugin.getInfo(urls): + #result = [ .. (name, size, status, url) .. ] if not type(result) == list: result = [result] self.m.core.files.updateFileInfo(result, self.pid) @@ -452,5 +453,7 @@ class InfoThread(PluginThread): self.m.core.files.save() except Exception, e: - self.m.core.log.debug("Info Fetching for %s failed | %s" % (pluginname,str) ) + self.m.core.log.warning(_("Info Fetching for %(name)s failed | %(err)s") % {"name": pluginname, "err": str(e)} ) + if self.m.core.debug: + print_exc() diff --git a/module/plugins/accounts/FilesonicCom.py b/module/plugins/accounts/FilesonicCom.py index f80a4a638..08f6ab4d2 100644 --- a/module/plugins/accounts/FilesonicCom.py +++ b/module/plugins/accounts/FilesonicCom.py @@ -31,7 +31,7 @@ class FilesonicCom(Account): __author_mail__ = ("RaNaN@pyload.org") def loadAccountInfo(self, user, req): - src = req.load("http://www.filesonic.com/user/settings") + src = req.load("http://www.filesonic.com/user/settings").decode("utf8") validuntil = re.search(r'\d+-\d+-\d+ \d+:\d+:\d+', src).group(0) validuntil = int(mktime(strptime(validuntil, "%Y-%m-%d %H:%M:%S"))) @@ -42,8 +42,9 @@ class FilesonicCom(Account): post_vars = { "email": user, "password": data["password"], + "rememberMe" : 1 } - page = req.load("http://www.filesonic.com/user/login", cookies=True, post=post_vars) + page = req.load("http://www.filesonic.com/user/login", cookies=True, post=post_vars).decode("utf8") - if "Provided password does not match." in page: + if "Provided password does not match." in page or "You must be logged in to view this page." in page: self.wrongPassword() diff --git a/module/plugins/hoster/FilesonicCom.py b/module/plugins/hoster/FilesonicCom.py index 5bd38655a..1d5a5ceef 100644 --- a/module/plugins/hoster/FilesonicCom.py +++ b/module/plugins/hoster/FilesonicCom.py @@ -5,7 +5,22 @@ import re from module.plugins.Hoster import Hoster
from module.plugins.ReCaptcha import ReCaptcha
-
+from module.plugins.Plugin import chunks
+
+from module.network.RequestFactory import getURL
+
+def getInfo(urls):
+ for chunk in chunks(urls, 15):
+ page = getURL("http://www.filesonic.com/link-checker", post={"links": "\n".join(chunk)}).decode("utf8", "ignore")
+
+ found = re.findall(r'<tr>\s+<td class="source"><span>([^<]+)</span></td>\s+<td class="fileName"><span>([^<]+)</span></td>\s+<td class="fileSize"><span>([0-9]+) MB</span></td>\s+<td class="availability"><span>\s+<strong style="font-weight: strong; color: green;">([^<]+)</strong><br />\s+</span>\s+</td>\s+</tr>', page, re.MULTILINE)
+ result = []
+ for src, name, size, status in found:
+ print src, name, size, status
+ result.append((name, int(size)*1024*1024, 2 if status == "Available" else 1, src))
+
+
+ yield result
class FilesonicCom(Hoster):
__name__ = "FilesonicCom"
diff --git a/module/remote/RemoteManager.py b/module/remote/RemoteManager.py index e57424eed..941aac6e8 100644 --- a/module/remote/RemoteManager.py +++ b/module/remote/RemoteManager.py @@ -68,8 +68,8 @@ class RemoteManager(): try: backend.setup(host, port) self.core.log.info(_("Starting %(name)s: %(addr)s:%(port)s") % {"name": b, "addr": host, "port": port}) - except: - self.core.log.error(_("Failed loading backend %s") % b) + except Exception, e: + self.core.log.error(_("Failed loading backend %(name)s | %(error)s") % {"name": b, "error": str(e)}) if self.core.debug: print_exc() else: diff --git a/module/web/webinterface.py b/module/web/webinterface.py index 54468d936..0e3c59730 100644 --- a/module/web/webinterface.py +++ b/module/web/webinterface.py @@ -39,49 +39,17 @@ from middlewares import StripPathMiddleware, GZipMiddleWare SETUP = None PYLOAD = None -try: - from module.web import ServerThread - - if not ServerThread.core: - if ServerThread.setup: - SETUP = ServerThread.setup - config = SETUP.config - else: - raise Exception +from module.web import ServerThread + +if not ServerThread.core: + if ServerThread.setup: + SETUP = ServerThread.setup + config = SETUP.config else: - PYLOAD = ServerThread.core.server_methods - config = ServerThread.core.config -except: - import xmlrpclib - - from module.ConfigParser import ConfigParser - config = ConfigParser() - - class wrap(): - authed = False - proxy = None - def checkAuth(self, username, password): - server_url = "http%s://%s:%s@%s:%s/" % ( - "s" if config.get("ssl", "activated") else "", - username, - password, - config.get("remote", "listenaddr"), - config.get("remote", "port") - ) - proxy = xmlrpclib.ServerProxy(server_url, allow_none=True) - try: - info = proxy.checkAuth(username, password) - except: - self.authed = False - return {} - self.proxy = proxy - self.authed = False - return info - - def __getattr__(self, attr): - return getattr(self.proxy, attr) - - PYLOAD = wrap() + raise Exception("Could not access pyLoad Core") +else: + PYLOAD = ServerThread.core.server_methods + config = ServerThread.core.config from module.JsEngine import JsEngine |