Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reactive paranoia warnings #641

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
6 changes: 4 additions & 2 deletions whipper/test/test_common_accurip.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,10 @@ def test_AccurateRipResponse_parses_correctly(self):
self.assertEqual(responses[1].discId1, '0000f21c')
self.assertEqual(responses[1].discId2, '00027ef8')
self.assertEqual(responses[1].cddbDiscId, '05021002')
self.assertEqual(responses[1].confidences[0], 7)
self.assertEqual(responses[1].confidences[1], 7)
# The following two values may increase in the Accurip database over time;
# both are 9 as retrieved on 2025-01-02
self.assertGreaterEqual(responses[1].confidences[0], 9)
self.assertGreaterEqual(responses[1].confidences[1], 9)
self.assertEqual(responses[1].checksums[0], 'dc77f9ab')
self.assertEqual(responses[1].checksums[1], 'dd97d2c3')

Expand Down
Loading