From b32a534a82dcbff7d5d600599c1d99b31ff85802 Mon Sep 17 00:00:00 2001 From: Thomas Vander Stichele Date: Sun, 22 May 2011 15:16:00 +0000 Subject: [PATCH] * morituri/program/cdparanoia.py: Since stop can be same as start, add + 1 to progress calculation. Fiexes #37. --- ChangeLog | 6 ++++++ morituri/program/cdparanoia.py | 10 ++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 782ab44..ddf8a40 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2011-05-22 Thomas Vander Stichele + + * morituri/program/cdparanoia.py: + Since stop can be same as start, add + 1 to progress calculation. + Fiexes #37. + 2011-05-22 Thomas Vander Stichele * morituri/common/gstreamer.py: diff --git a/morituri/program/cdparanoia.py b/morituri/program/cdparanoia.py index dc23a5b..4c3bd1f 100644 --- a/morituri/program/cdparanoia.py +++ b/morituri/program/cdparanoia.py @@ -203,7 +203,7 @@ class ReadTrackTask(task.Task): @type table: L{table.Table} @param start: first frame to rip @type start: int - @param stop: last frame to rip (inclusive) + @param stop: last frame to rip (inclusive); >= start @type stop: int @param offset: read offset, in samples @type offset: int @@ -305,9 +305,11 @@ class ReadTrackTask(task.Task): self.debug('%d errors, terminating', self._parser.errors) self._popen.terminate() - num = float(self._parser.wrote) - self._start - den = float(self._stop) - self._start - progress = num / den + num = self._parser.wrote - self._start + 1 + den = self._stop - self._start + 1 + assert den != 0, "stop %d should be >= start %d" % ( + self._stop, self._start) + progress = float(num) / float(den) if progress < 1.0: self.setProgress(progress)