Skip to content

Commit f6cd9b2

Browse files
committed
Warn about offset > 587 only after the rip fails with size 0:
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. Signed-off-by: Avery Sterk <[email protected]>
1 parent 459f6f9 commit f6cd9b2

File tree

1 file changed

+20
-14
lines changed

1 file changed

+20
-14
lines changed

whipper/program/cdparanoia.py

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -283,17 +283,6 @@ def start(self, runner):
283283
stopTrack, common.framesToHMSF(stopOffset)),
284284
self.path])
285285
logger.debug('running %s', (" ".join(argv), ))
286-
if self._offset > 587:
287-
logger.warning(
288-
"because of a cd-paranoia upstream bug whipper may fail to "
289-
"work correctly when using offset values > 587 (current "
290-
"value: %d) and print warnings like this: 'file size 0 did "
291-
"not match expected size'. For more details please check the "
292-
"following issues: "
293-
"https://github.com/whipper-team/whipper/issues/234 and "
294-
"https://github.com/rocky/libcdio-paranoia/issues/14",
295-
self._offset
296-
)
297286
if stopTrack == 99:
298287
logger.warning(
299288
"because of a cd-paranoia upstream bug whipper may fail to "
@@ -372,8 +361,25 @@ def _done(self):
372361
# check if the length matches
373362
size = os.stat(self.path)[stat.ST_SIZE]
374363
# wav header is 44 bytes
375-
offsetLength = self._stop - self._start + 1
376-
expected = offsetLength * common.BYTES_PER_FRAME + 44
364+
frameCount = self._stop - self._start + 1
365+
expected = frameCount * common.BYTES_PER_FRAME + 44
366+
if size == 0:
367+
368+
if self._offset > 587:
369+
logger.warning(
370+
"file is empty, possibly because of a cd-paranoia upstream "
371+
"bug when using offset values > 587 (current value: %d). "
372+
"For more details please check the following issues: "
373+
"https://github.com/whipper-team/whipper/issues/234 and "
374+
"https://github.com/rocky/libcdio-paranoia/issues/14",
375+
self._offset
376+
)
377+
else:
378+
logger.warning('file is empty')
379+
self.setAndRaiseException(FileSizeError(self.path,
380+
"File is empty, "
381+
"expected size %d" % (
382+
expected )))
377383
if size != expected:
378384
# FIXME: handle errors better
379385
logger.warning('file size %d did not match expected size %d',
@@ -399,7 +405,7 @@ def _done(self):
399405

400406
self.quality = self._parser.getTrackQuality()
401407
self.duration = end_time - self._start_time
402-
self.speed = (offsetLength / 75.0) / self.duration
408+
self.speed = (frameCount / 75.0) / self.duration
403409

404410
self.stop()
405411
return

0 commit comments

Comments
 (0)