diff --git a/docs/ext/local.rst b/docs/ext/local.rst index 5d3562a9..31d00d66 100644 --- a/docs/ext/local.rst +++ b/docs/ext/local.rst @@ -90,6 +90,7 @@ See :ref:`config` for general help on configuring Mopidy. Number of tracks to wait before telling library it should try and store its progress so far. Some libraries might not respect this setting. + Set this to zero to disable flushing. .. confval:: local/excluded_file_extensions diff --git a/mopidy/local/commands.py b/mopidy/local/commands.py index 5e4bfe62..85939b43 100644 --- a/mopidy/local/commands.py +++ b/mopidy/local/commands.py @@ -144,10 +144,14 @@ class _Progress(object): def increment(self): self.count += 1 - return self.count % self.batch_size == 0 + return self.batch_size and self.count % self.batch_size == 0 def log(self): duration = time.time() - self.start - remainder = duration / self.count * (self.total - self.count) - logger.info('Scanned %d of %d files in %ds, ~%ds left.', - self.count, self.total, duration, remainder) + if self.count >= self.total or not self.count: + logger.info('Scanned %d of %d files in %ds.', + self.count, self.total, duration) + else: + remainder = duration / self.count * (self.total - self.count) + logger.info('Scanned %d of %d files in %ds, ~%ds left.', + self.count, self.total, duration, remainder)