Skip to content

Commit

Permalink
Raise exception when cdparanoia can't read any frames
Browse files Browse the repository at this point in the history
This commit effectively reverts #159. Whipper now raises an exception again but with a clearer textual description.

Closes #202.
  • Loading branch information
JoeLametta committed Nov 9, 2018
1 parent 1449911 commit c0637b1
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions whipper/program/cdparanoia.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,16 +192,17 @@ def getTrackQuality(self):
reads = self.reads
logger.debug('getTrackQuality: frames %d, reads %d' % (frames, reads))

# don't go over a 100%; we know cdparanoia reads each frame at least
# twice
try:
# don't go over a 100%
# we know that cdparanoia reads each frame at least twice
return min(frames * 2.0 / reads, 1.0)
except ZeroDivisionError:
return 0

raise RuntimeError("cdparanoia couldn't read any frames "
"for the current track")

# FIXME: handle errors


class ReadTrackTask(task.Task):
"""
I am a task that reads a track using cdparanoia.
Expand Down

0 comments on commit c0637b1

Please sign in to comment.