From 702ab35e37437300a2ded26e66011faaac06f902 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 20 Oct 2014 12:57:26 +0200 Subject: Fix download resume feature --- module/network/HTTPDownload.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/module/network/HTTPDownload.py b/module/network/HTTPDownload.py index fe8075539..3f32295b4 100644 --- a/module/network/HTTPDownload.py +++ b/module/network/HTTPDownload.py @@ -63,7 +63,7 @@ class HTTPDownload(): except IOError: self.info = ChunkInfo(filename) - self.chunkSupport = None + self.chunkSupport = True self.m = pycurl.CurlMulti() #needed for speed calculation @@ -130,7 +130,7 @@ class HTTPDownload(): except pycurl.error, e: #code 33 - no resume code = e.args[0] - if code == 33: + if resume is True and code == 33: # try again without resume self.log.debug("Errno 33 -> Restart without resume") @@ -151,6 +151,7 @@ class HTTPDownload(): if not resume: self.info.clear() self.info.addChunk("%s.chunk0" % self.filename, (0, 0)) #create an initial entry + self.info.save() self.chunks = [] @@ -164,8 +165,8 @@ class HTTPDownload(): chunksDone = set() # list of curl handles that are finished chunksCreated = False done = False - if self.info.getCount() > 1: # This is a resume, if we were chunked originally assume still can - self.chunkSupport = True + if self.info.getCount() is 0: # This is a resume, if we were chunked originally assume still can + self.chunkSupport = False while 1: #need to create chunks -- cgit v1.2.3