* morituri/program/cdparanoia.py:
* morituri/common/encode.py: * morituri/common/program.py: * morituri/rip/cd.py: Add action and what args to describe task better.
This commit is contained in:
@@ -1,3 +1,11 @@
|
||||
2011-05-19 Thomas Vander Stichele <thomas at apestaart dot org>
|
||||
|
||||
* morituri/program/cdparanoia.py:
|
||||
* morituri/common/encode.py:
|
||||
* morituri/common/program.py:
|
||||
* morituri/rip/cd.py:
|
||||
Add action and what args to describe task better.
|
||||
|
||||
2011-05-19 Thomas Vander Stichele <thomas at apestaart dot org>
|
||||
|
||||
* morituri/common/task.py:
|
||||
|
||||
@@ -137,7 +137,7 @@ class EncodeTask(task.Task):
|
||||
description = 'Encoding'
|
||||
peak = None
|
||||
|
||||
def __init__(self, inpath, outpath, profile, taglist=None):
|
||||
def __init__(self, inpath, outpath, profile, taglist=None, what="track"):
|
||||
"""
|
||||
@param profile: encoding profile
|
||||
@type profile: L{Profile}
|
||||
@@ -154,6 +154,7 @@ class EncodeTask(task.Task):
|
||||
self._peakdB = None
|
||||
self._profile = profile
|
||||
|
||||
self.description = "Encoding %s" % what
|
||||
self._profile.test()
|
||||
|
||||
def start(self, runner):
|
||||
@@ -162,7 +163,7 @@ class EncodeTask(task.Task):
|
||||
# here to avoid import gst eating our options
|
||||
import gst
|
||||
|
||||
self._pipeline = gst.parse_launch('''
|
||||
desc = '''
|
||||
filesrc location="%s" !
|
||||
decodebin name=decoder !
|
||||
audio/x-raw-int,width=16,depth=16,channels=2 !
|
||||
@@ -171,7 +172,10 @@ class EncodeTask(task.Task):
|
||||
filesink location="%s" name=sink''' % (
|
||||
common.quoteParse(self._inpath).encode('utf-8'),
|
||||
self._profile.pipeline,
|
||||
common.quoteParse(self._outpath).encode('utf-8')))
|
||||
common.quoteParse(self._outpath).encode('utf-8'))
|
||||
|
||||
self.debug('creating pipeline: %r', desc)
|
||||
self._pipeline = gst.parse_launch(desc)
|
||||
|
||||
tagger = self._pipeline.get_by_name('tagger')
|
||||
|
||||
@@ -272,6 +276,8 @@ class EncodeTask(task.Task):
|
||||
self.debug('setting state to NULL')
|
||||
self._pipeline.set_state(gst.STATE_NULL)
|
||||
self.debug('set state to NULL')
|
||||
# FIXME: maybe this should move lower ? If used by BaseMultiTask,
|
||||
# this starts the next task without showing us the peakdB
|
||||
task.Task.stop(self)
|
||||
|
||||
if self._peakdB is not None:
|
||||
|
||||
@@ -461,7 +461,8 @@ class Program(log.Loggable):
|
||||
|
||||
return trackResult.testcrc == t.checksum
|
||||
|
||||
def ripTrack(self, runner, trackResult, offset, device, profile, taglist):
|
||||
def ripTrack(self, runner, trackResult, offset, device, profile, taglist,
|
||||
what=None):
|
||||
"""
|
||||
@param trackResult: the object to store information in.
|
||||
@type trackResult: L{result.TrackResult}
|
||||
@@ -478,13 +479,16 @@ class Program(log.Loggable):
|
||||
if not os.path.exists(dirname):
|
||||
os.makedirs(dirname)
|
||||
|
||||
if not what:
|
||||
what='track %d' % (trackResult.number, )
|
||||
|
||||
t = cdparanoia.ReadVerifyTrackTask(trackResult.filename,
|
||||
self.result.table, start, stop,
|
||||
offset=offset,
|
||||
device=device,
|
||||
profile=profile,
|
||||
taglist=taglist)
|
||||
t.description = 'Reading Track %d' % trackResult.number
|
||||
taglist=taglist,
|
||||
what=what)
|
||||
|
||||
runner.run(t)
|
||||
|
||||
|
||||
@@ -187,12 +187,13 @@ class ReadTrackTask(task.Task):
|
||||
@ivar reads: how many reads were done to rip the track
|
||||
"""
|
||||
|
||||
description = "Reading Track"
|
||||
description = "Reading track"
|
||||
quality = None # set at end of reading
|
||||
|
||||
_MAXERROR = 100 # number of errors detected by parser
|
||||
|
||||
def __init__(self, path, table, start, stop, offset=0, device=None):
|
||||
def __init__(self, path, table, start, stop, offset=0, device=None,
|
||||
action="Reading", what="track"):
|
||||
"""
|
||||
Read the given track.
|
||||
|
||||
@@ -208,6 +209,10 @@ class ReadTrackTask(task.Task):
|
||||
@type offset: int
|
||||
@param device: the device to rip from
|
||||
@type device: str
|
||||
@param action: a string representing the action; e.g. Read/Verify
|
||||
@type action: str
|
||||
@param what: a string representing what's being read; e.g. Track
|
||||
@type what: str
|
||||
"""
|
||||
assert type(path) is unicode, "%r is not unicode" % path
|
||||
|
||||
@@ -221,6 +226,7 @@ class ReadTrackTask(task.Task):
|
||||
|
||||
self._buffer = "" # accumulate characters
|
||||
self._errors = []
|
||||
self.description = "%s %s" % (action, what)
|
||||
|
||||
def start(self, runner):
|
||||
task.Task.start(self, runner)
|
||||
@@ -371,7 +377,7 @@ class ReadVerifyTrackTask(task.MultiSeparateTask):
|
||||
_tmppath = None
|
||||
|
||||
def __init__(self, path, table, start, stop, offset=0, device=None,
|
||||
profile=None, taglist=None):
|
||||
profile=None, taglist=None, what="track"):
|
||||
"""
|
||||
@param path: where to store the ripped track
|
||||
@type path: str
|
||||
@@ -392,6 +398,7 @@ class ReadVerifyTrackTask(task.MultiSeparateTask):
|
||||
"""
|
||||
task.MultiSeparateTask.__init__(self)
|
||||
|
||||
self.debug('Creating read and verify task on %r', path)
|
||||
self.path = path
|
||||
|
||||
if taglist:
|
||||
@@ -408,11 +415,10 @@ class ReadVerifyTrackTask(task.MultiSeparateTask):
|
||||
self.tasks = []
|
||||
self.tasks.append(
|
||||
ReadTrackTask(tmppath, table, start, stop,
|
||||
offset=offset, device=device))
|
||||
offset=offset, device=device, what=what))
|
||||
self.tasks.append(checksum.CRC32Task(tmppath))
|
||||
t = ReadTrackTask(tmppath, table, start, stop,
|
||||
offset=offset, device=device)
|
||||
t.description = 'Verifying track...'
|
||||
offset=offset, device=device, action="Verifying", what=what)
|
||||
self.tasks.append(t)
|
||||
self.tasks.append(checksum.CRC32Task(tmppath))
|
||||
|
||||
@@ -426,7 +432,7 @@ class ReadVerifyTrackTask(task.MultiSeparateTask):
|
||||
from morituri.common import encode
|
||||
|
||||
self.tasks.append(encode.EncodeTask(tmppath, tmpoutpath, profile,
|
||||
taglist=taglist))
|
||||
taglist=taglist, what=what))
|
||||
# make sure our encoding is accurate
|
||||
self.tasks.append(checksum.CRC32Task(tmpoutpath))
|
||||
|
||||
|
||||
@@ -215,7 +215,8 @@ See http://sourceforge.net/tracker/?func=detail&aid=604751&group_id=2171&atid=1
|
||||
offset=int(self.options.offset),
|
||||
device=self.parentCommand.options.device,
|
||||
profile=profile,
|
||||
taglist=prog.getTagList(number))
|
||||
taglist=prog.getTagList(number),
|
||||
what='track %d of %d' % (number, len(itable.tracks)))
|
||||
|
||||
if trackResult.testcrc == trackResult.copycrc:
|
||||
print 'Checksums match for track %d' % (number)
|
||||
|
||||
Reference in New Issue
Block a user