diff --git a/whipper/program/cdparanoia.py b/whipper/program/cdparanoia.py index 5c4b7793..78c7173d 100644 --- a/whipper/program/cdparanoia.py +++ b/whipper/program/cdparanoia.py @@ -283,17 +283,6 @@ def start(self, runner): stopTrack, common.framesToHMSF(stopOffset)), self.path]) logger.debug('running %s', (" ".join(argv), )) - if self._offset > 587: - logger.warning( - "because of a cd-paranoia upstream bug whipper may fail to " - "work correctly when using offset values > 587 (current " - "value: %d) and print warnings like this: 'file size 0 did " - "not match expected size'. For more details please check the " - "following issues: " - "https://github.com/whipper-team/whipper/issues/234 and " - "https://github.com/rocky/libcdio-paranoia/issues/14", - self._offset - ) if stopTrack == 99: logger.warning( "because of a cd-paranoia upstream bug whipper may fail to " @@ -372,8 +361,25 @@ def _done(self): # check if the length matches size = os.stat(self.path)[stat.ST_SIZE] # wav header is 44 bytes - offsetLength = self._stop - self._start + 1 - expected = offsetLength * common.BYTES_PER_FRAME + 44 + frameCount = self._stop - self._start + 1 + expected = frameCount * common.BYTES_PER_FRAME + 44 + if size == 0: + + if self._offset > 587: + logger.warning( + "file is empty, possibly because of a cd-paranoia upstream " + "bug when using offset values > 587 (current value: %d). " + "For more details please check the following issues: " + "https://github.com/whipper-team/whipper/issues/234 and " + "https://github.com/rocky/libcdio-paranoia/issues/14", + self._offset + ) + else: + logger.warning('file is empty') + self.setAndRaiseException(FileSizeError(self.path, + "File is empty, " + "expected size %d" % ( + expected ))) if size != expected: # FIXME: handle errors better logger.warning('file size %d did not match expected size %d', @@ -399,7 +405,7 @@ def _done(self): self.quality = self._parser.getTrackQuality() self.duration = end_time - self._start_time - self.speed = (offsetLength / 75.0) / self.duration + self.speed = (frameCount / 75.0) / self.duration self.stop() return