[SCM] morituri/master: * examples/ARcue.py: Make output a bit nicer, mentioning whether tracks were accurately ripped.

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


The following commit has been merged in the master branch:
commit 051dc33049ec6f0d18ad1a1c6b423441c3a5bf16
Author: Thomas Vander Stichele <thomas (at) apestaart (dot) org>
Date:   Mon Apr 13 20:00:11 2009 +0000

    	* examples/ARcue.py:
    	  Make output a bit nicer, mentioning whether tracks were
    	  accurately ripped.

diff --git a/ChangeLog b/ChangeLog
index 848bf76..37db8ea 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2009-04-13  Thomas Vander Stichele  <thomas at apestaart dot org>
 
+	* examples/ARcue.py:
+	  Make output a bit nicer, mentioning whether tracks were
+	  accurately ripped.
+
+2009-04-13  Thomas Vander Stichele  <thomas at apestaart dot org>
+
 	* morituri/image/image.py:
 	  Add an object to parse the response of AccurateRip.
 	* morituri/test/test_image_image.py:
diff --git a/examples/ARcue.py b/examples/ARcue.py
index f37aa82..462e04d 100644
--- a/examples/ARcue.py
+++ b/examples/ARcue.py
@@ -20,6 +20,7 @@
 # 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
 import sys
 import optparse
 
@@ -69,21 +70,32 @@ def main(argv):
 
     if options.runner == 'cli':
         runner = task.SyncRunner()
-        cueImage.setup(runner)
-        print "CDDB disc id", cueImage.getCDDBDiscId()
-        print "AccurateRip URL", cueImage.getAccurateRipURL()
-        climain(runner, verifytask)
-        climain(runner, cuetask)
+        function = climain
     elif options.runner == 'gtk':
         runner = task.GtkProgressRunner()
-        cueImage.setup(runner)
-        print "CDDB disc id", cueImage.getCDDBDiscId()
-        print "AccurateRip URL", cueImage.getAccurateRipURL()
-        gtkmain(runner, verifytask)
-        gtkmain(runner, cuetask)
+        function = gtkmain
+
+    cueImage.setup(runner)
+    print "CDDB disc id", cueImage.getCDDBDiscId()
+    url = cueImage.getAccurateRipURL()
+    print "AccurateRip URL", url
+
+    # FIXME: download url as a task too
+    import urllib
+    (filename, headers) = urllib.urlretrieve(url) 
+    data = open(filename, 'rb').read()
+    os.unlink(filename)
+    response = image.AccurateRipResponse(data)
+
+    function(runner, verifytask)
+    function(runner, cuetask)
 
     for i, crc in enumerate(cuetask.crcs):
-        print "Track %2d: %08x" % (i + 1, crc)
+        status = '   rip accurate       '
+        if "%08x" % crc != response.crcs[i]:
+            status = '** rip not accurate **'
+        print "Track %2d: %s (confidence %d) [%08x] [%s]" % (
+            i + 1, status, response.confidences[i], crc, response.crcs[i])
 
 
 main(sys.argv)

-- 
morituri packaging



More information about the pkg-multimedia-commits mailing list