r394 - in branches/rewrite: . src
Otavio Salvador
partial-mirror-devel@lists.alioth.debian.org
Sat, 11 Dec 2004 19:04:40 -0700
Author: otavio
Date: Sat Dec 11 19:04:38 2004
New Revision: 394
Modified:
branches/rewrite/ (props changed)
branches/rewrite/src/Download.py
Log:
r434@nurf: otavio | 2004-12-12T02:03:47.856483Z
Include namespace.
Modified: branches/rewrite/src/Download.py
==============================================================================
--- branches/rewrite/src/Download.py (original)
+++ branches/rewrite/src/Download.py Sat Dec 11 19:04:38 2004
@@ -19,11 +19,10 @@
import pycurl
import threading
-from Queue import Queue, Empty
-from os.path import getsize, exists, getmtime
-from DisplayStatus import *
+import Queue
+import DisplayStatus
-class DownloadQueue(Queue):
+class DownloadQueue(Queue.Queue):
counter = 0
""" Implement a Queue without duplicated items. """
@@ -80,14 +79,14 @@
def __init__(self, info = None, downloaders = 3):
# Add DisplayStatus object.
if info == None:
- self.DisplayStatus = TextDisplayStatus()
+ self.DisplayStatus = DisplayStatus.TextDisplayStatus()
else:
self.DisplayStatus = info
# Create the needed pycurl objects to manage the connections.
self._multi = pycurl.CurlMulti()
self._multi.handles = []
- self._free = Queue()
+ self._free = Queue.Queue()
for i in range(downloaders):
curl = Curl(self.DisplayStatus)
self._multi.handles.append(curl)
@@ -106,12 +105,12 @@
while 1:
try:
fetcher = self._free.get_nowait()
- except Empty:
+ except Queue.Empty:
break # No fetcher available, process the pending.
try:
url, filename = Download.queue.get_nowait()
- except Empty:
+ except Queue.Empty:
break # Empty queue. Continue processing the others.
# Get a free fetcher