* 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.
This commit is contained in:
Thomas Vander Stichele
2011-05-24 15:15:44 +00:00
parent b540b10c33
commit 234ac4c644
4 changed files with 21 additions and 4 deletions

View File

@@ -1,3 +1,12 @@
2011-05-24 Thomas Vander Stichele <thomas at apestaart dot org>
* 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 <thomas at apestaart dot org>
* morituri/common/task.py:

View File

@@ -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)

View File

@@ -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

View File

@@ -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: