r353 - in branches/rewrite: . src
Otavio Salvador
partial-mirror-devel@lists.alioth.debian.org
Fri, 19 Nov 2004 16:13:53 -0700
Author: otavio
Date: Fri Nov 19 16:13:51 2004
New Revision: 353
Modified:
branches/rewrite/ (props changed)
branches/rewrite/src/Download.py
Log:
r348@nurf: otavio | 2004-11-19T22:19:38.055750Z
Disable resume by now since it doesn't check changed times. We need fix it later.
Modified: branches/rewrite/src/Download.py
==============================================================================
--- branches/rewrite/src/Download.py (original)
+++ branches/rewrite/src/Download.py Fri Nov 19 16:13:51 2004
@@ -20,7 +20,7 @@
import threading
from Queue import Queue, Empty
-from os.path import getsize, exists
+from os.path import getsize, exists, getmtime
from DisplayStatus import *
class DownloadQueue(Queue):
@@ -57,7 +57,11 @@
curl = pycurl.Curl()
if exists(filename):
- curl.setopt(pycurl.RESUME_FROM_LARGE, getsize(filename))
+ # FIXME: Need check the size of file and if it doesn't
+ # match download it (or resume).
+ curl.setopt(pycurl.TIMECONDITION, pycurl.TIMECONDITION_IFMODSINCE)
+ curl.setopt(pycurl.TIMEVALUE, getmtime(filename))
+ #curl.setopt(pycurl.RESUME_FROM_LARGE, getsize(filename))
curl.setopt(pycurl.FOLLOWLOCATION, 1)
curl.setopt(pycurl.MAXREDIRS, 5)
@@ -69,7 +73,7 @@
curl.setopt(pycurl.TIMEOUT, 300)
curl.setopt(pycurl.FAILONERROR, 1)
- f = open(filename, "ab")
+ f = open(filename, "w+b")
curl.setopt(pycurl.WRITEFUNCTION, f.write)
self.url = url