From bdd63224c2d3760a0ded8be2b354abc139a1e858 Mon Sep 17 00:00:00 2001 From: RaNaN Date: Fri, 3 Jun 2011 00:29:40 +0200 Subject: wupload fix --- module/PluginThread.py | 3 +-- module/PyFile.py | 2 +- module/ThreadManager.py | 5 +++-- module/plugins/hoster/FilesonicCom.py | 8 +++++++- 4 files changed, 12 insertions(+), 6 deletions(-) (limited to 'module') diff --git a/module/PluginThread.py b/module/PluginThread.py index 007a17ef1..4f138f858 100644 --- a/module/PluginThread.py +++ b/module/PluginThread.py @@ -409,8 +409,7 @@ class HookThread(PluginThread): def run(self): self.f(self.active) - - + self.m.localThreads.remove(self) if isinstance(self.active, PyFile): self.active.finishIfDone() diff --git a/module/PyFile.py b/module/PyFile.py index 0b5dc48be..25e65e34a 100644 --- a/module/PyFile.py +++ b/module/PyFile.py @@ -172,7 +172,7 @@ class PyFile(object): def finishIfDone(self): """set status to finish and release file if every thread is finished with it""" - + if self.id in self.m.core.threadManager.processingIds(): return False diff --git a/module/ThreadManager.py b/module/ThreadManager.py index fd47fada2..7b40fe05c 100644 --- a/module/ThreadManager.py +++ b/module/ThreadManager.py @@ -29,6 +29,7 @@ from random import choice import pycurl import PluginThread +from module.PyFile import PyFile from module.network.RequestFactory import getURL from module.utils import freeSpace @@ -78,12 +79,12 @@ class ThreadManager: #---------------------------------------------------------------------- def downloadingIds(self): """get a list of the currently downloading pyfile's ids""" - return [x.active.id for x in self.threads if x.active and x.active != "quit"] + return [x.active.id for x in self.threads if x.active and isinstance(x.active, PyFile)] #---------------------------------------------------------------------- def processingIds(self): """get a id list of all pyfiles processed""" - return [x.active.id for x in self.threads + self.localThreads if x.active and x.active != "quit"] + return [x.active.id for x in self.threads + self.localThreads if x.active and isinstance(x.active, PyFile)] #---------------------------------------------------------------------- diff --git a/module/plugins/hoster/FilesonicCom.py b/module/plugins/hoster/FilesonicCom.py index cbe74f214..ba6c4c963 100644 --- a/module/plugins/hoster/FilesonicCom.py +++ b/module/plugins/hoster/FilesonicCom.py @@ -121,7 +121,13 @@ class FilesonicCom(Hoster): def downloadPremium(self): self.logDebug("Premium download") - self.download(self.pyfile.url) + + api = self.API_ADDRESS + "/link?method=getDownloadLink&u=%s&p=%s&ids=%s" % ( + self.user, self.account.getAccountData(self.user)["password"], getId(self.pyfile.url)) + + result = json_loads(self.load(api)) + dl = result["FSApi_Link"]["getDownloadLink"]["response"]["links"][0]["url"] + self.download(dl) def downloadFree(self): self.logDebug("Free download") -- cgit v1.2.3