def getstring(self): speed = int(self.state * self.size / 100.0 / (time.time() - self.starttime)) eta = (100 - self.state) * self.size / 100.0 / speed return ConsoleProgressBar.getstring( self) + " %s %12s/s %3i:%02i ETA" % (self.sizeof_fmt( self.size), self.sizeof_fmt(speed), eta / 60, eta % 60)
def __call__(self, *args, **kwargs): ret = ConsoleProgressBar.__call__(self, *args, **kwargs) if self.redirect: self.redirect(self.state) return ret
def getstring(self): speed = int(self.state * self.size / 100.0 / (time.time() - self.starttime)) eta = (100 - self.state) * self.size / 100.0 / speed return ConsoleProgressBar.getstring(self) + " %s %12s/s %3i:%02i ETA" % (self.sizeof_fmt(self.size), self.sizeof_fmt(speed), eta/60, eta%60)
def __init__(self, filename, size): print "Downloading", filename ConsoleProgressBar.__init__(self, "progress:", 20) self.size = size self.starttime = time.time() self.speed = 0.0