From ea04c11ce1fb52895449a56e862eff5448ea456a Mon Sep 17 00:00:00 2001 From: mkaay Date: Thu, 24 Dec 2009 01:28:08 +0100 Subject: downloads are now aborted correctly, gui: remove downloads, new icons --- module/network/Request.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'module/network/Request.py') diff --git a/module/network/Request.py b/module/network/Request.py index 752c16f04..651553a0f 100755 --- a/module/network/Request.py +++ b/module/network/Request.py @@ -304,7 +304,7 @@ class Request: def writefunc(buf): if self.abort: - raise AbortDownload + return False chunkSize = len(buf) while chunkSize > restLimit() > -1: time.sleep(0.05) @@ -316,8 +316,12 @@ class Request: self.pycurl.setopt(pycurl.WRITEFUNCTION, writefunc) - - self.pycurl.perform() + try: + self.pycurl.perform() + except Exception, e: + code, msg = e + if not code == 23: + raise Exception, e #~ if "..." in file_name: #~ download_folder = dirname(file_name) + sep #~ headers = self.get_header() @@ -438,7 +442,6 @@ class Request: def get_speed(self): try: - #return (self.dl_arrived / ((time.time() if self.dl else self.dl_finished) - self.dl_time)) / 1024 return self.dl_speed except: return 0 @@ -453,7 +456,8 @@ class Request: return (self.dl_size - self.dl_arrived) / 1024 def progress(self, dl_t, dl_d, up_t, up_d): - if self.abort: raise AbortDownload + if self.abort: + return False self.dl_arrived = int(dl_d) self.dl_size = int(dl_t) -- cgit v1.2.3