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')
|
||||
if len(self.done_events) < 5:
|
||||
return _('calculating time left')
|
||||
try:
|
||||
start_time = self.done_events[0][1]
|
||||
end_time = self.done_events[-1][1]
|
||||
num_done = sum(x[0] for x in self.done_events) - self.done_events[0][0]
|
||||
rate = num_done / max(0.1, end_time - start_time)
|
||||
seconds_left = self.left / rate
|
||||
return _('~{} left').format(human_readable_interval(seconds_left))
|
||||
except Exception:
|
||||
return _('calculating time left')
|
||||
|
||||
|
||||
class ScanProgress(QWidget):
|
||||
|
Loading…
x
Reference in New Issue
Block a user