[SCM] morituri/master: * 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.

js at users.alioth.debian.org js at users.alioth.debian.org
Sun Oct 19 20:09:08 UTC 2014


The following commit has been merged in the master branch:
commit efdc8308933e4752cb87c5f7a0ce0f681c48b4aa
Author: Thomas Vander Stichele <thomas (at) apestaart (dot) org>
Date:   Tue Jun 16 21:09:27 2009 +0000

    	* 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.

diff --git a/ChangeLog b/ChangeLog
index 47a2421..0c3cfa9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 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>
+
 	* morituri/common/drive.py:
 	  Really make pycdio and cdio optional.
 	* morituri/rip/drive.py:
diff --git a/morituri/common/program.py b/morituri/common/program.py
index 133c0a2..afb8bce 100644
--- a/morituri/common/program.py
+++ b/morituri/common/program.py
@@ -409,12 +409,19 @@ class Program(log.Loggable):
                     trackResult.accuripDatabaseConfidence = confidence
 
             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)
                 trackResult.accuripDatabaseMaxConfidence = maxConfidence
                 if not response:
                     self.warning('none of the responses matched.')
-
+                    trackResult.accuripDatabaseCRC = int(
+                        maxResponse.checksums[i], 16)
 
     def writeCue(self, discName):
         self.debug('write .cue file')
diff --git a/morituri/rip/cd.py b/morituri/rip/cd.py
index c31599d..a0016ed 100644
--- a/morituri/rip/cd.py
+++ b/morituri/rip/cd.py
@@ -301,7 +301,7 @@ class Rip(logcommand.LogCommand):
 
                 ar = ", AR [%08x]" % trackResult.accuripDatabaseCRC
                 print "Track %2d: %s %s [%08x]%s" % (
-                    i + 1, status, c, trackResult.accuripDatabaseCRC, ar)
+                    i + 1, status, c, trackResult.accuripCRC, ar)
 
         # write log file
         logger = result.getLogger()
diff --git a/morituri/rip/drive.py b/morituri/rip/image.py
similarity index 52%
copy from morituri/rip/drive.py
copy to morituri/rip/image.py
index f36adc3..bcfc504 100644
--- a/morituri/rip/drive.py
+++ b/morituri/rip/image.py
@@ -20,35 +20,33 @@
 # You should have received a copy of the GNU General Public License
 # along with morituri.  If not, see <http://www.gnu.org/licenses/>.
 
-import os
+from morituri.common import logcommand, task, checksum, accurip, program
+from morituri.image import image, cue
+from morituri.program import cdrdao, cdparanoia
 
-from morituri.common import logcommand
 
-class List(logcommand.LogCommand):
-    summary = "list drives"
+class Verify(logcommand.LogCommand):
+    summary = "verify image"
 
     def do(self, args):
-        paths = drive.getAllDevicePaths()
+        prog = program.Program()
+        runner = task.SyncRunner()
+        cache = accurip.AccuCache()
 
-        if not paths:
-            print 'No drives found.'
-            print 'Create /dev/cdrom if you have a CD drive, '
-            print 'or install pycdio for better detection.'
+        for arg in args:
+            cueImage = image.Image(arg)
+            cueImage.setup(runner)
 
-            return
-
-        for path in paths:
-            device = cdio.Device(path)
-            ok, vendor, model, release = device.get_hwinfo()
-            print "drive: %s, vendor: %s, model: %s, release: %s" % (
-                path, vendor, model, release)
-
-        if not paths:
-            print 'No drives found.'
+            url = cueImage.table.getAccurateRipURL()
+            responses = cache.retrieve(url)
 
-class Drive(logcommand.LogCommand):
-    summary = "handle drives"
-
-    subCommandClasses = [List, ]
+            return
+            
+            # FIXME: finish implementation
+            prog.cuePath = arg
+            prog.verifyImage(runner, responses) 
 
+class Image(logcommand.LogCommand):
+    summary = "handle images"
 
+    subCommandClasses = [Verify, ]
diff --git a/morituri/rip/main.py b/morituri/rip/main.py
index e797d33..651a65e 100644
--- a/morituri/rip/main.py
+++ b/morituri/rip/main.py
@@ -4,7 +4,7 @@
 import sys
 
 from morituri.common import log, logcommand
-from morituri.rip import cd, offset, drive
+from morituri.rip import cd, offset, drive, image
 
 def main(argv):
     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.
 """
 
-    subCommandClasses = [cd.CD, drive.Drive, offset.Offset, ]
+    subCommandClasses = [cd.CD, drive.Drive, offset.Offset, image.Image, ]
 
     def addOptions(self):
         # FIXME: is this the right place ?

-- 
morituri packaging



More information about the pkg-multimedia-commits mailing list