Skip to content

Commit

Permalink
Warn about offset > 587 only after the rip fails with size 0:
Browse files Browse the repository at this point in the history
Upstream cd-paranoia fixed the offset issue, but we can't check
whether the installed version contains the fix. Instead of warning
everyone before the rip starts, warn only the people who get
an empty file with the large offset.

Don't show size mismatch warnings for zero-size files

Signed-off-by: Avery <[email protected]>
  • Loading branch information
saint-erk committed Jan 5, 2025
1 parent 18de1ba commit 12c6688
Showing 1 changed file with 21 additions and 15 deletions.
36 changes: 21 additions & 15 deletions whipper/program/cdparanoia.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 "
Expand Down Expand Up @@ -372,9 +361,26 @@ 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
if size != expected:
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 )))
elif size != expected:
# FIXME: handle errors better
logger.warning('file size %d did not match expected size %d',
size, expected)
Expand All @@ -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
Expand Down

0 comments on commit 12c6688

Please sign in to comment.