diff options
Diffstat (limited to 'pyload')
-rw-r--r-- | pyload/database/DatabaseBackend.py | 3 | ||||
-rw-r--r-- | pyload/manager/AddonManager.py | 12 | ||||
-rw-r--r-- | pyload/manager/event/Scheduler.py | 7 | ||||
-rw-r--r-- | pyload/plugins/hook/BypassCaptcha.py | 4 | ||||
-rw-r--r-- | pyload/plugins/hook/Captcha9kw.py | 4 | ||||
-rw-r--r-- | pyload/plugins/hook/CaptchaBrotherhood.py | 3 | ||||
-rw-r--r-- | pyload/plugins/hook/DeathByCaptcha.py | 3 | ||||
-rw-r--r-- | pyload/plugins/hook/ExpertDecoders.py | 4 | ||||
-rw-r--r-- | pyload/plugins/hook/ImageTyperz.py | 4 |
9 files changed, 17 insertions, 27 deletions
diff --git a/pyload/database/DatabaseBackend.py b/pyload/database/DatabaseBackend.py index 9ebe31701..b25a3c32e 100644 --- a/pyload/database/DatabaseBackend.py +++ b/pyload/database/DatabaseBackend.py @@ -15,8 +15,7 @@ @author: RaNaN @author: mkaay """ -from threading import Thread -from threading import Event +from threading import Event, Thread from os import remove from os.path import exists from shutil import move diff --git a/pyload/manager/AddonManager.py b/pyload/manager/AddonManager.py index 5ad62f515..a394373a9 100644 --- a/pyload/manager/AddonManager.py +++ b/pyload/manager/AddonManager.py @@ -20,8 +20,7 @@ import __builtin__ import traceback -from thread import start_new_thread -from threading import RLock +from threading import RLock, Thread from types import MethodType @@ -149,7 +148,6 @@ class AddonManager: self.deactivateAddon(plugin) def activateAddon(self, plugin): - #check if already loaded for inst in self.plugins: if inst.__name__ == plugin: @@ -166,10 +164,12 @@ class AddonManager: self.pluginMap[pluginClass.__name__] = plugin # call core Ready - start_new_thread(plugin.coreReady, tuple()) + t = Thread(target=plugin.coreReady) + t.setDaemon(True) + t.start() - def deactivateAddon(self, plugin): + def deactivateAddon(self, plugin): addon = None for inst in self.plugins: if inst.__name__ == plugin: @@ -253,7 +253,7 @@ class AddonManager: self.dispatchEvent("afterReconnecting", ip) def startThread(self, function, *args, **kwargs): - t = AddonThread(self.core.threadManager, function, args, kwargs) + return AddonThread(self.core.threadManager, function, args, kwargs) def activePlugins(self): """ returns all active plugins """ diff --git a/pyload/manager/event/Scheduler.py b/pyload/manager/event/Scheduler.py index 71b5f96af..39dfbc3cc 100644 --- a/pyload/manager/event/Scheduler.py +++ b/pyload/manager/event/Scheduler.py @@ -19,8 +19,7 @@ from time import time from heapq import heappop, heappush -from thread import start_new_thread -from threading import Lock +from threading import Lock, Thread class AlreadyCalled(Exception): pass @@ -106,7 +105,9 @@ class Job: def start(self): if self.threaded: - start_new_thread(self.run, ()) + t = Thread(target=self.run) + t.setDaemon(True) + t.start() else: self.run() diff --git a/pyload/plugins/hook/BypassCaptcha.py b/pyload/plugins/hook/BypassCaptcha.py index c8842b1bf..112066353 100644 --- a/pyload/plugins/hook/BypassCaptcha.py +++ b/pyload/plugins/hook/BypassCaptcha.py @@ -1,7 +1,6 @@ # -*- coding: utf-8 -*- from pycurl import FORM_FILE, LOW_SPEED_TIME -from thread import start_new_thread from pyload.network.HTTPRequest import BadHeader from pyload.network.RequestFactory import getURL, getRequest @@ -107,8 +106,7 @@ class BypassCaptcha(Hook): task.handler.append(self) task.data['service'] = self.__name__ task.setWaiting(100) - start_new_thread(self.processCaptcha, (task,)) - + self.processCaptcha(task) else: self.logInfo(_("Your %s account has not enough credits") % self.__name__) diff --git a/pyload/plugins/hook/Captcha9kw.py b/pyload/plugins/hook/Captcha9kw.py index d99ceeec3..fa4710542 100644 --- a/pyload/plugins/hook/Captcha9kw.py +++ b/pyload/plugins/hook/Captcha9kw.py @@ -5,7 +5,6 @@ from __future__ import with_statement import re from base64 import b64encode -from thread import start_new_thread from time import sleep from pyload.network.HTTPRequest import BadHeader @@ -19,8 +18,7 @@ class Captcha9kw(Hook): __type__ = "hook" __version__ = "0.24" - __config__ = [("activated", "bool", "Activated", True), - ("ssl", "bool", "Use HTTPS", True), + __config__ = [("ssl", "bool", "Use HTTPS", True), ("force", "bool", "Force captcha resolving even if client is connected", True), ("confirm", "bool", "Confirm Captcha (cost +6 credits)", False), ("captchaperhour", "int", "Captcha per hour", "9999"), diff --git a/pyload/plugins/hook/CaptchaBrotherhood.py b/pyload/plugins/hook/CaptchaBrotherhood.py index 208462c14..8c037009a 100644 --- a/pyload/plugins/hook/CaptchaBrotherhood.py +++ b/pyload/plugins/hook/CaptchaBrotherhood.py @@ -10,7 +10,6 @@ try: except ImportError: import Image -from thread import start_new_thread from time import sleep from urllib import urlencode @@ -145,7 +144,7 @@ class CaptchaBrotherhood(Hook): task.handler.append(self) task.data['service'] = self.__name__ task.setWaiting(100) - start_new_thread(self.processCaptcha, (task,)) + self.processCaptcha(task) else: self.logInfo(_("Your CaptchaBrotherhood Account has not enough credits")) diff --git a/pyload/plugins/hook/DeathByCaptcha.py b/pyload/plugins/hook/DeathByCaptcha.py index e4477565c..429258f89 100644 --- a/pyload/plugins/hook/DeathByCaptcha.py +++ b/pyload/plugins/hook/DeathByCaptcha.py @@ -6,7 +6,6 @@ import re from base64 import b64encode from pycurl import FORM_FILE, HTTPHEADER -from thread import start_new_thread from time import sleep from pyload.utils import json_loads @@ -186,7 +185,7 @@ class DeathByCaptcha(Hook): task.handler.append(self) task.data['service'] = self.__name__ task.setWaiting(180) - start_new_thread(self.processCaptcha, (task,)) + self.processCaptcha(task) def captchaInvalid(self, task): diff --git a/pyload/plugins/hook/ExpertDecoders.py b/pyload/plugins/hook/ExpertDecoders.py index f57ef55bb..658a55288 100644 --- a/pyload/plugins/hook/ExpertDecoders.py +++ b/pyload/plugins/hook/ExpertDecoders.py @@ -4,7 +4,6 @@ from __future__ import with_statement from base64 import b64encode from pycurl import LOW_SPEED_TIME -from thread import start_new_thread from uuid import uuid4 from pyload.network.HTTPRequest import BadHeader @@ -76,8 +75,7 @@ class ExpertDecoders(Hook): if self.getCredits() > 0: task.handler.append(self) task.setWaiting(100) - start_new_thread(self.processCaptcha, (task,)) - + self.processCaptcha(task) else: self.logInfo(_("Your ExpertDecoders Account has not enough credits")) diff --git a/pyload/plugins/hook/ImageTyperz.py b/pyload/plugins/hook/ImageTyperz.py index 1c99d48c1..57a734884 100644 --- a/pyload/plugins/hook/ImageTyperz.py +++ b/pyload/plugins/hook/ImageTyperz.py @@ -6,7 +6,6 @@ import re from base64 import b64encode from pycurl import FORM_FILE, LOW_SPEED_TIME -from thread import start_new_thread from pyload.network.RequestFactory import getURL, getRequest from pyload.plugins.internal.Addon import Hook @@ -121,8 +120,7 @@ class ImageTyperz(Hook): task.handler.append(self) task.data['service'] = self.__name__ task.setWaiting(100) - start_new_thread(self.processCaptcha, (task,)) - + self.processCaptcha(task) else: self.logInfo(_("Your %s account has not enough credits") % self.__name__) |