mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 18:24:30 -04:00
Handle done events with no actual files done
This commit is contained in:
parent
f9b6a39b2a
commit
f77b3e778a
@ -56,12 +56,15 @@ class IndexingProgress:
|
|||||||
return _('almost done')
|
return _('almost done')
|
||||||
if len(self.done_events) < 5:
|
if len(self.done_events) < 5:
|
||||||
return _('calculating time left')
|
return _('calculating time left')
|
||||||
start_time = self.done_events[0][1]
|
try:
|
||||||
end_time = self.done_events[-1][1]
|
start_time = self.done_events[0][1]
|
||||||
num_done = sum(x[0] for x in self.done_events) - self.done_events[0][0]
|
end_time = self.done_events[-1][1]
|
||||||
rate = num_done / max(0.1, end_time - start_time)
|
num_done = sum(x[0] for x in self.done_events) - self.done_events[0][0]
|
||||||
seconds_left = self.left / rate
|
rate = num_done / max(0.1, end_time - start_time)
|
||||||
return _('~{} left').format(human_readable_interval(seconds_left))
|
seconds_left = self.left / rate
|
||||||
|
return _('~{} left').format(human_readable_interval(seconds_left))
|
||||||
|
except Exception:
|
||||||
|
return _('calculating time left')
|
||||||
|
|
||||||
|
|
||||||
class ScanProgress(QWidget):
|
class ScanProgress(QWidget):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user