summaryrefslogtreecommitdiffstats
path: root/pyload/manager
diff options
context:
space:
mode:
Diffstat (limited to 'pyload/manager')
-rw-r--r--pyload/manager/Captcha.py7
-rw-r--r--pyload/manager/Event.py9
-rw-r--r--pyload/manager/Plugin.py4
-rw-r--r--pyload/manager/Scheduler.py6
-rw-r--r--pyload/manager/Thread.py18
5 files changed, 22 insertions, 22 deletions
diff --git a/pyload/manager/Captcha.py b/pyload/manager/Captcha.py
index 748f2e425..271e6122b 100644
--- a/pyload/manager/Captcha.py
+++ b/pyload/manager/Captcha.py
@@ -2,10 +2,9 @@
# @author: RaNaN, mkaay
import threading
+import time
import traceback
-from time import time
-
from pyload.utils import encode
@@ -112,7 +111,7 @@ class CaptchaTask(object):
def setWaiting(self, sec):
""" let the captcha wait secs for the solution """
- self.waitUntil = max(time() + sec, self.waitUntil)
+ self.waitUntil = max(time.time() + sec, self.waitUntil)
self.status = "waiting"
@@ -141,7 +140,7 @@ class CaptchaTask(object):
def timedOut(self):
- return time() > self.waitUntil
+ return time.time() > self.waitUntil
def invalid(self):
diff --git a/pyload/manager/Event.py b/pyload/manager/Event.py
index b3d22619f..919835984 100644
--- a/pyload/manager/Event.py
+++ b/pyload/manager/Event.py
@@ -1,7 +1,8 @@
# -*- coding: utf-8 -*-
# @author: mkaay
-from time import time
+import time
+
from pyload.utils import uniqify
@@ -18,7 +19,7 @@ class PullManager(object):
def clean(self):
for n, client in enumerate(self.clients):
- if client.lastActive + 30 < time():
+ if client.lastActive + 30 < time.time():
del self.clients[n]
@@ -27,7 +28,7 @@ class PullManager(object):
validUuid = False
for client in self.clients:
if client.uuid == uuid:
- client.lastActive = time()
+ client.lastActive = time.time()
validUuid = True
while client.newEvents():
events.append(client.popEvent().toList())
@@ -47,7 +48,7 @@ class Client(object):
def __init__(self, uuid):
self.uuid = uuid
- self.lastActive = time()
+ self.lastActive = time.time()
self.events = []
diff --git a/pyload/manager/Plugin.py b/pyload/manager/Plugin.py
index 19898069c..36213eb7a 100644
--- a/pyload/manager/Plugin.py
+++ b/pyload/manager/Plugin.py
@@ -6,10 +6,10 @@ import os
import re
import sys
import traceback
+import urllib
from itertools import chain
from sys import version_info
-from urllib import unquote
from SafeEval import const_eval as literal_eval
@@ -196,7 +196,7 @@ class PluginManager(object):
if type(url) not in (str, unicode, buffer):
continue
- url = unquote(url)
+ url = urllib.unquote(url)
if last and last[2]['re'].match(url):
res.append((url, last[0], last[1]))
diff --git a/pyload/manager/Scheduler.py b/pyload/manager/Scheduler.py
index d7098ae10..630e43022 100644
--- a/pyload/manager/Scheduler.py
+++ b/pyload/manager/Scheduler.py
@@ -2,9 +2,9 @@
# @author: mkaay
import threading
+import time
from heapq import heappop, heappush
-from time import time
class AlreadyCalled(Exception):
@@ -42,7 +42,7 @@ class Scheduler(object):
def addJob(self, t, call, args=[], kwargs={}, threaded=True):
d = Deferred()
- t += time()
+ t += time.time()
j = Job(t, call, args, kwargs, d, threaded)
self.queue.put((t, j))
return d
@@ -72,7 +72,7 @@ class Scheduler(object):
if not j:
break
else:
- if t <= time():
+ if t <= time.time():
j.start()
else:
self.queue.put((t, j))
diff --git a/pyload/manager/Thread.py b/pyload/manager/Thread.py
index abc7b2fef..0acfd4751 100644
--- a/pyload/manager/Thread.py
+++ b/pyload/manager/Thread.py
@@ -5,13 +5,13 @@ import os
import random
import re
import threading
+import time
import traceback
import pycurl
from random import choice
from subprocess import Popen
-from time import sleep, time
from pyload.Datatype import PyFile
from pyload.Thread import DecrypterThread, DownloadThread, InfoThread
@@ -67,7 +67,7 @@ class ThreadManager(object):
start a thread whichs fetches online status and other infos
data = [ .. () .. ]
"""
- self.timestamp = time() + 5 * 60
+ self.timestamp = time.time() + 5 * 60
InfoThread(self, data, pid)
@@ -75,7 +75,7 @@ class ThreadManager(object):
@lock
def createResultThread(self, data, add=False):
""" creates a thread to fetch online status, returns result id """
- self.timestamp = time() + 5 * 60
+ self.timestamp = time.time() + 5 * 60
rid = self.resultIDs
self.resultIDs += 1
@@ -88,7 +88,7 @@ class ThreadManager(object):
@lock
def getInfoResult(self, rid):
"""returns result and clears it"""
- self.timestamp = time() + 5 * 60
+ self.timestamp = time.time() + 5 * 60
if rid in self.infoResults:
data = self.infoResults[rid]
@@ -135,11 +135,11 @@ class ThreadManager(object):
if self.core.debug:
traceback.print_exc()
- sleep(0.5)
+ time.sleep(0.5)
self.assignJob()
# it may be failed non critical so we try it again
- if (self.infoCache or self.infoResults) and self.timestamp < time():
+ if (self.infoCache or self.infoResults) and self.timestamp < time.time():
self.infoCache.clear()
self.infoResults.clear()
self.core.log.debug("Cleared Result cache")
@@ -172,7 +172,7 @@ class ThreadManager(object):
self.core.log.info(_("Starting reconnect"))
while [x.active.plugin.waiting for x in self.threads if x.active].count(True) != 0:
- sleep(0.25)
+ time.sleep(0.25)
ip = self.getIP()
@@ -191,7 +191,7 @@ class ThreadManager(object):
return
reconn.wait()
- sleep(1)
+ time.sleep(1)
ip = self.getIP()
self.core.addonManager.afterReconnecting(ip)
@@ -214,7 +214,7 @@ class ThreadManager(object):
break
except Exception:
ip = ""
- sleep(1)
+ time.sleep(1)
return ip