diff --git a/ChangeLog b/ChangeLog index b9fb218..7e02960 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2011-05-24 Thomas Vander Stichele + + * morituri/common/common.py: + Add an EmptyError. + * morituri/common/checksum.py: + Set it when we don't get any frames. + * morituri/rip/main.py: + Catch it and stop ripping if this happens. + 2011-05-24 Thomas Vander Stichele * morituri/common/task.py: diff --git a/morituri/common/checksum.py b/morituri/common/checksum.py index 5e6e4b1..ac34030 100644 --- a/morituri/common/checksum.py +++ b/morituri/common/checksum.py @@ -30,7 +30,6 @@ from morituri.common import common, task, gstreamer # checksums are not CRC's. a CRC is a specific type of checksum. - class ChecksumTask(gstreamer.GstPipelineTask): """ I am a task that calculates a checksum of the decoded audio data. @@ -91,7 +90,6 @@ class ChecksumTask(gstreamer.GstPipelineTask): length, qformat = sink.query_duration(gst.FORMAT_DEFAULT) except gst.QueryError, e: self.setException(e) - self.stop() return # wavparse 0.10.14 returns in bytes @@ -141,8 +139,7 @@ class ChecksumTask(gstreamer.GstPipelineTask): def stopped(self): if not self._last: # see http://bugzilla.gnome.org/show_bug.cgi?id=578612 - print 'ERROR: checksum: not a single buffer gotten' - # FIXME: instead of print, do something useful + self.setException(common.EmptyError('not a single buffer gotten')) else: self._checksum = self._checksum % 2 ** 32 self.debug("last offset %r", self._last.offset) diff --git a/morituri/common/common.py b/morituri/common/common.py index 4f221d6..7833bf0 100644 --- a/morituri/common/common.py +++ b/morituri/common/common.py @@ -212,9 +212,14 @@ def tagListEquals(tl1, tl2): return d1 == d2 + class MissingDependencyException(Exception): dependency = None def __init__(self, *args): self.args = args self.dependency = args[0] + + +class EmptyError(Exception): + pass diff --git a/morituri/rip/main.py b/morituri/rip/main.py index 69bae1e..0754821 100644 --- a/morituri/rip/main.py +++ b/morituri/rip/main.py @@ -31,6 +31,12 @@ cdrdao says: %s """ % e.exception.msg) return 255 + + if isinstance(e.exception, common.EmptyError): + sys.stderr.write( + 'rip: error: Could not create encoded file.\n') + return 255 + raise if ret is None: