From 63d747c7c9ff2d6753cee22faa18d14f7d148428 Mon Sep 17 00:00:00 2001 From: RaNaN Date: Mon, 9 Aug 2010 13:05:38 +0200 Subject: netload premium --- module/FileDatabase.py | 7 +++++-- module/PluginThread.py | 19 ++++++++++--------- module/plugins/accounts/NetloadIn.py | 36 ++++++++++++++++++++++++++++++++++++ module/plugins/hoster/NetloadIn.py | 10 +--------- module/web/ajax/views.py | 1 + 5 files changed, 53 insertions(+), 20 deletions(-) create mode 100644 module/plugins/accounts/NetloadIn.py diff --git a/module/FileDatabase.py b/module/FileDatabase.py index 3ede67a98..62f42917e 100644 --- a/module/FileDatabase.py +++ b/module/FileDatabase.py @@ -188,9 +188,12 @@ class FileHandler: f = self.getFile(id) e = RemoveEvent("file", id, "collector" if not f.package().queue else "queue") + + if id in self.core.threadManager.processingIds(): + self.cache[id].abortDownload() + if self.cache.has_key(id): - if id in self.core.threadManager.processingIds(): - self.cache[id].abortDownload() + del self.cache[id] self.lock.release() diff --git a/module/PluginThread.py b/module/PluginThread.py index 592fc7521..35aee66be 100644 --- a/module/PluginThread.py +++ b/module/PluginThread.py @@ -115,12 +115,16 @@ class DownloadThread(PluginThread): continue except error, e: - code, msg = e - print "pycurl error", code, msg - + code, msg = e if self.m.core.debug: + print "pycurl error", code, msg print_exc() + if code == 7: + self.m.log.warning(_("Couldn't connect to host waiting 1 minute and retry.")) + self.queue.put(pyfile) + continue + self.active = False pyfile.release() continue @@ -290,14 +294,11 @@ class InfoThread(PluginThread): for pluginname, urls in plugins.iteritems(): plugin = self.m.core.pluginManager.getPlugin(plugin) if hasattr(plugin, "getInfo"): - print "get", urls - print "" + self.m.core.log.debug("Run Info Fetching for %s" % pluginname) for result in plugin.getInfo(urls): if not type(result) == list: result = [result] - print "updating", result - print "" self.m.core.files.updateFileInfo(result) + + self.m.core.log.debug("Finished Info Fetching for %s" % pluginname) - print "" - print "finished info fetching" self.m.core.files.save() \ No newline at end of file diff --git a/module/plugins/accounts/NetloadIn.py b/module/plugins/accounts/NetloadIn.py new file mode 100644 index 000000000..95e77a9cb --- /dev/null +++ b/module/plugins/accounts/NetloadIn.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- + +""" + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, + or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see . + + @author: mkaay +""" + +from module.plugins.Account import Account +import re +from time import strptime, mktime + +class NetloadIn(Account): + __name__ = "NetloadIn" + __version__ = "0.1" + __type__ = "account" + __description__ = """netload.in account plugin""" + __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 diff --git a/module/plugins/hoster/NetloadIn.py b/module/plugins/hoster/NetloadIn.py index 059d6a8f8..f9e3d31ad 100644 --- a/module/plugins/hoster/NetloadIn.py +++ b/module/plugins/hoster/NetloadIn.py @@ -75,13 +75,6 @@ class NetloadIn(Hoster): self.pyfile.setStatus("downloading") self.proceed(self.url) - def getInfo(self): - self.log.debug("Netload: Info prefetch") - self.download_api_data() - if self.api_data and self.api_data["filename"]: - self.pyfile.name = self.api_data["filename"] - self.pyfile.sync() - def prepare(self): self.download_api_data() @@ -215,7 +208,6 @@ class NetloadIn(Hoster): def proceed(self, url): self.log.debug("Netload: Downloading..") - if self.account: - self.req.load("http://netload.in/index.php", None, { "txtuser" : self.config['username'], "txtpass" : self.config['password'], "txtcheck" : "login", "txtlogin" : ""}, cookies=True) + self.download(url, cookies=True) diff --git a/module/web/ajax/views.py b/module/web/ajax/views.py index 588881eea..0ad5e5156 100644 --- a/module/web/ajax/views.py +++ b/module/web/ajax/views.py @@ -202,6 +202,7 @@ def remove_package(request, id): settings.PYLOAD.del_packages([int(id)]) return JsonResponse("sucess") except Exception, e: + print_exc() return HttpResponseServerError() @permission('pyload.can_add_dl') -- cgit v1.2.3