* morituri/rip/main.py:
* morituri/rip/image.py (added): Add command to verify an image. * morituri/common/program.py: * morituri/rip/cd.py: Fix AccurateRip checksum output.
This commit is contained in:
@@ -1,3 +1,12 @@
|
|||||||
|
2009-06-16 Thomas Vander Stichele <thomas at apestaart dot org>
|
||||||
|
|
||||||
|
* morituri/rip/main.py:
|
||||||
|
* morituri/rip/image.py (added):
|
||||||
|
Add command to verify an image.
|
||||||
|
* morituri/common/program.py:
|
||||||
|
* morituri/rip/cd.py:
|
||||||
|
Fix AccurateRip checksum output.
|
||||||
|
|
||||||
2009-06-16 Thomas Vander Stichele <thomas at apestaart dot org>
|
2009-06-16 Thomas Vander Stichele <thomas at apestaart dot org>
|
||||||
|
|
||||||
* morituri/common/drive.py:
|
* morituri/common/drive.py:
|
||||||
|
|||||||
@@ -409,12 +409,19 @@ class Program(log.Loggable):
|
|||||||
trackResult.accuripDatabaseConfidence = confidence
|
trackResult.accuripDatabaseConfidence = confidence
|
||||||
|
|
||||||
if responses:
|
if responses:
|
||||||
maxConfidence = max(r.confidences[i] for r in responses)
|
maxConfidence = 0
|
||||||
|
maxResponse = None
|
||||||
|
for r in responses:
|
||||||
|
if r.confidences[i] > maxConfidence:
|
||||||
|
maxConfidence = r.confidences[i]
|
||||||
|
maxResponse = r
|
||||||
|
|
||||||
self.debug('found max confidence %d' % maxConfidence)
|
self.debug('found max confidence %d' % maxConfidence)
|
||||||
trackResult.accuripDatabaseMaxConfidence = maxConfidence
|
trackResult.accuripDatabaseMaxConfidence = maxConfidence
|
||||||
if not response:
|
if not response:
|
||||||
self.warning('none of the responses matched.')
|
self.warning('none of the responses matched.')
|
||||||
|
trackResult.accuripDatabaseCRC = int(
|
||||||
|
maxResponse.checksums[i], 16)
|
||||||
|
|
||||||
def writeCue(self, discName):
|
def writeCue(self, discName):
|
||||||
self.debug('write .cue file')
|
self.debug('write .cue file')
|
||||||
|
|||||||
@@ -301,7 +301,7 @@ class Rip(logcommand.LogCommand):
|
|||||||
|
|
||||||
ar = ", AR [%08x]" % trackResult.accuripDatabaseCRC
|
ar = ", AR [%08x]" % trackResult.accuripDatabaseCRC
|
||||||
print "Track %2d: %s %s [%08x]%s" % (
|
print "Track %2d: %s %s [%08x]%s" % (
|
||||||
i + 1, status, c, trackResult.accuripDatabaseCRC, ar)
|
i + 1, status, c, trackResult.accuripCRC, ar)
|
||||||
|
|
||||||
# write log file
|
# write log file
|
||||||
logger = result.getLogger()
|
logger = result.getLogger()
|
||||||
|
|||||||
52
morituri/rip/image.py
Normal file
52
morituri/rip/image.py
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
# -*- Mode: Python -*-
|
||||||
|
# vi:si:et:sw=4:sts=4:ts=4
|
||||||
|
|
||||||
|
# Morituri - for those about to RIP
|
||||||
|
|
||||||
|
# Copyright (C) 2009 Thomas Vander Stichele
|
||||||
|
|
||||||
|
# This file is part of morituri.
|
||||||
|
#
|
||||||
|
# morituri is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# morituri is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with morituri. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
from morituri.common import logcommand, task, checksum, accurip, program
|
||||||
|
from morituri.image import image, cue
|
||||||
|
from morituri.program import cdrdao, cdparanoia
|
||||||
|
|
||||||
|
|
||||||
|
class Verify(logcommand.LogCommand):
|
||||||
|
summary = "verify image"
|
||||||
|
|
||||||
|
def do(self, args):
|
||||||
|
prog = program.Program()
|
||||||
|
runner = task.SyncRunner()
|
||||||
|
cache = accurip.AccuCache()
|
||||||
|
|
||||||
|
for arg in args:
|
||||||
|
cueImage = image.Image(arg)
|
||||||
|
cueImage.setup(runner)
|
||||||
|
|
||||||
|
url = cueImage.table.getAccurateRipURL()
|
||||||
|
responses = cache.retrieve(url)
|
||||||
|
|
||||||
|
return
|
||||||
|
|
||||||
|
# FIXME: finish implementation
|
||||||
|
prog.cuePath = arg
|
||||||
|
prog.verifyImage(runner, responses)
|
||||||
|
|
||||||
|
class Image(logcommand.LogCommand):
|
||||||
|
summary = "handle images"
|
||||||
|
|
||||||
|
subCommandClasses = [Verify, ]
|
||||||
@@ -4,7 +4,7 @@
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
from morituri.common import log, logcommand
|
from morituri.common import log, logcommand
|
||||||
from morituri.rip import cd, offset, drive
|
from morituri.rip import cd, offset, drive, image
|
||||||
|
|
||||||
def main(argv):
|
def main(argv):
|
||||||
c = Rip()
|
c = Rip()
|
||||||
@@ -32,7 +32,7 @@ Rip gives you a tree of subcommands to work with.
|
|||||||
You can get help on subcommands by using the -h option to the subcommand.
|
You can get help on subcommands by using the -h option to the subcommand.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
subCommandClasses = [cd.CD, drive.Drive, offset.Offset, ]
|
subCommandClasses = [cd.CD, drive.Drive, offset.Offset, image.Image, ]
|
||||||
|
|
||||||
def addOptions(self):
|
def addOptions(self):
|
||||||
# FIXME: is this the right place ?
|
# FIXME: is this the right place ?
|
||||||
|
|||||||
Reference in New Issue
Block a user