Skip to content

Commit

Permalink
Merge pull request #328 from whipper-team/feature/issue-202-zerodivis…
Browse files Browse the repository at this point in the history
…ionerror

Raise exception when cdparanoia can't read any frames
  • Loading branch information
JoeLametta authored Nov 9, 2018
2 parents 8cec469 + c0637b1 commit f1aaaec
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 f1aaaec

Please sign in to comment.