[SCM] morituri/master: * examples/ARcue.py: Handle case where we have no matching response.

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


The following commit has been merged in the master branch:
commit 99d90552d33e27e28e554990e7eccd7553742f6b
Author: Thomas Vander Stichele <thomas (at) apestaart (dot) org>
Date:   Mon May 4 08:39:12 2009 +0000

    	* examples/ARcue.py:
    	  Handle case where we have no matching response.

diff --git a/ChangeLog b/ChangeLog
index dd26279..afea5d6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-05-04  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+	* examples/ARcue.py:
+	  Handle case where we have no matching response.
+
 2009-05-03  Thomas Vander Stichele  <thomas at apestaart dot org>
 
 	* morituri/common/task.py:
diff --git a/examples/ARcue.py b/examples/ARcue.py
index 65a51c4..f8a9848 100644
--- a/examples/ARcue.py
+++ b/examples/ARcue.py
@@ -106,14 +106,16 @@ def main(argv):
     function(runner, verifytask)
     function(runner, cuetask)
 
-    response = None
+    response = None # track which response matches, for all tracks
 
+    # loop over tracks
     for i, checksum in enumerate(cuetask.checksums):
         status = 'rip NOT accurate'
 
         confidence = None
         archecksum = None
 
+        # match against each response's checksum
         for j, r in enumerate(responses):
             if "%08x" % checksum == r.checksums[i]:
                 if not response:
@@ -128,16 +130,19 @@ def main(argv):
                 confidence = response.confidences[i]
 
         c = "(not found)"
-        ar = ""
+        ar = "(not in database)"
         if responses:
-            maxConfidence = max(r.confidences[i] for r in responses)
-                 
-            c = "(confidence %3d)" % maxConfidence
-            if confidence is not None:
-                if confidence < maxConfidence:
-                    c = "(confidence %3d of %3d)" % (confidence, maxConfidence)
-
-            ar = ", AR [%s]" % response.checksums[i]
+            if not response:
+                print 'ERROR: none of the responses matched.'
+            else:
+                maxConfidence = max(r.confidences[i] for r in responses)
+                     
+                c = "(confidence %3d)" % maxConfidence
+                if confidence is not None:
+                    if confidence < maxConfidence:
+                        c = "(confidence %3d of %3d)" % (confidence, maxConfidence)
+
+                ar = ", AR [%s]" % response.checksums[i]
         print "Track %2d: %s %s [%08x]%s" % (
             i + 1, status, c, checksum, ar)
 

-- 
morituri packaging



More information about the pkg-multimedia-commits mailing list