* morituri/common/program.py:
* morituri/rip/cd.py: Move HTOA checking to program.
This commit is contained in:
@@ -1,3 +1,9 @@
|
|||||||
|
2009-06-07 Thomas Vander Stichele <thomas at apestaart dot org>
|
||||||
|
|
||||||
|
* morituri/common/program.py:
|
||||||
|
* morituri/rip/cd.py:
|
||||||
|
Move HTOA checking to program.
|
||||||
|
|
||||||
2009-06-07 Thomas Vander Stichele <thomas at apestaart dot org>
|
2009-06-07 Thomas Vander Stichele <thomas at apestaart dot org>
|
||||||
|
|
||||||
* morituri/result/logger.py:
|
* morituri/result/logger.py:
|
||||||
|
|||||||
@@ -287,6 +287,41 @@ class Program(object):
|
|||||||
|
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
def getHTOA(self):
|
||||||
|
"""
|
||||||
|
Check if we have hidden track one audio.
|
||||||
|
|
||||||
|
@returns: tuple of (start, stop), or None
|
||||||
|
"""
|
||||||
|
track = self.result.table.tracks[0]
|
||||||
|
try:
|
||||||
|
index = track.getIndex(0)
|
||||||
|
except KeyError:
|
||||||
|
return None
|
||||||
|
|
||||||
|
start = index.absolute
|
||||||
|
stop = track.getIndex(1).absolute
|
||||||
|
return (start, stop)
|
||||||
|
|
||||||
|
def ripTrack(self, runner, trackResult, path, number, offset, device, profile, taglist):
|
||||||
|
"""
|
||||||
|
@param number: track number (1-based)
|
||||||
|
"""
|
||||||
|
t = cdparanoia.ReadVerifyTrackTask(path, self.result.table,
|
||||||
|
self.result.table.getTrackStart(number),
|
||||||
|
self.result.table.getTrackEnd(number),
|
||||||
|
offset=offset,
|
||||||
|
device=device,
|
||||||
|
profile=profile,
|
||||||
|
taglist=taglist)
|
||||||
|
t.description = 'Reading Track %d' % (number)
|
||||||
|
|
||||||
|
runner.run(t)
|
||||||
|
|
||||||
|
trackResult.testcrc = t.testchecksum
|
||||||
|
trackResult.copycrc = t.copychecksum
|
||||||
|
trackResult.peak = t.peak
|
||||||
|
trackResult.quality = t.quality
|
||||||
|
|
||||||
def writeCue(self, discName):
|
def writeCue(self, discName):
|
||||||
assert self.result.table.canCue()
|
assert self.result.table.canCue()
|
||||||
|
|||||||
@@ -151,17 +151,9 @@ class Rip(logcommand.LogCommand):
|
|||||||
|
|
||||||
|
|
||||||
# check for hidden track one audio
|
# check for hidden track one audio
|
||||||
htoapath = None
|
htoa = prog.getHTOA()
|
||||||
index = None
|
if htoa:
|
||||||
track = itable.tracks[0]
|
start, stop = htoa
|
||||||
try:
|
|
||||||
index = track.getIndex(0)
|
|
||||||
except KeyError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
if index:
|
|
||||||
start = index.absolute
|
|
||||||
stop = track.getIndex(1).absolute
|
|
||||||
print 'Found Hidden Track One Audio from frame %d to %d' % (
|
print 'Found Hidden Track One Audio from frame %d to %d' % (
|
||||||
start, stop)
|
start, stop)
|
||||||
|
|
||||||
@@ -210,6 +202,7 @@ class Rip(logcommand.LogCommand):
|
|||||||
mbdiscid, i + 1) + '.' + extension
|
mbdiscid, i + 1) + '.' + extension
|
||||||
trackResult.number = i + 1
|
trackResult.number = i + 1
|
||||||
trackResult.filename = path
|
trackResult.filename = path
|
||||||
|
trackResult.pregap = itable.tracks[i].getPregap()
|
||||||
|
|
||||||
dirname = os.path.dirname(path)
|
dirname = os.path.dirname(path)
|
||||||
if not os.path.exists(dirname):
|
if not os.path.exists(dirname):
|
||||||
@@ -219,28 +212,19 @@ class Rip(logcommand.LogCommand):
|
|||||||
if not os.path.exists(path):
|
if not os.path.exists(path):
|
||||||
print 'Ripping track %d of %d: %s' % (
|
print 'Ripping track %d of %d: %s' % (
|
||||||
i + 1, len(itable.tracks), os.path.basename(path))
|
i + 1, len(itable.tracks), os.path.basename(path))
|
||||||
t = cdparanoia.ReadVerifyTrackTask(path, ittoc,
|
prog.ripTrack(runner, trackResult, path, i + 1,
|
||||||
ittoc.getTrackStart(i + 1),
|
|
||||||
ittoc.getTrackEnd(i + 1),
|
|
||||||
offset=int(self.options.offset),
|
offset=int(self.options.offset),
|
||||||
device=self.parentCommand.options.device,
|
device=self.parentCommand.options.device,
|
||||||
profile=profile,
|
profile=profile,
|
||||||
taglist=prog.getTagList(metadata, i + 1))
|
taglist=prog.getTagList(metadata, i + 1))
|
||||||
t.description = 'Reading Track %d' % (i + 1)
|
|
||||||
function(runner, t)
|
if trackResult.testcrc == trackResult.copycrc:
|
||||||
if t.checksum:
|
|
||||||
print 'Checksums match for track %d' % (i + 1)
|
print 'Checksums match for track %d' % (i + 1)
|
||||||
else:
|
else:
|
||||||
print 'ERROR: checksums did not match for track %d' % (
|
print 'ERROR: checksums did not match for track %d' % (
|
||||||
i + 1)
|
i + 1)
|
||||||
trackResult.testcrc = t.testchecksum
|
print 'Peak level: %.2f %%' % (math.sqrt(trackResult.peak) * 100.0, )
|
||||||
trackResult.copycrc = t.copychecksum
|
print 'Rip quality: %.2f %%' % (trackResult.quality * 100.0, )
|
||||||
trackResult.peak = t.peak
|
|
||||||
trackResult.quality = t.quality
|
|
||||||
trackResult.pregap = itable.tracks[i].getPregap()
|
|
||||||
|
|
||||||
print 'Peak level: %.2f %%' % (math.sqrt(t.peak) * 100.0, )
|
|
||||||
print 'Rip quality: %.2f %%' % (t.quality * 100.0, )
|
|
||||||
|
|
||||||
# overlay this rip onto the Table
|
# overlay this rip onto the Table
|
||||||
itable.setFile(i + 1, 1, path, ittoc.getTrackLength(i + 1), i + 1)
|
itable.setFile(i + 1, 1, path, ittoc.getTrackLength(i + 1), i + 1)
|
||||||
|
|||||||
Reference in New Issue
Block a user