[SCM] morituri/master: * examples/readhtoa.py (added): Add an example that detects and rips the Hidden Track One Audio.

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


The following commit has been merged in the master branch:
commit 2acff6bd945af6041ff358b22c6bb67757238f66
Author: Thomas Vander Stichele <thomas (at) apestaart (dot) org>
Date:   Fri May 1 20:05:04 2009 +0000

    	* examples/readhtoa.py (added):
    	  Add an example that detects and rips the Hidden Track One Audio.

diff --git a/ChangeLog b/ChangeLog
index 0eb76f3..0239ccc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2009-05-01  Thomas Vander Stichele  <thomas at apestaart dot org>
 
+	* examples/readhtoa.py (added):
+	  Add an example that detects and rips the Hidden Track One Audio.
+
+2009-05-01  Thomas Vander Stichele  <thomas at apestaart dot org>
+
 	* examples/readtoc.py:
 	* morituri/program/cdrdao.py (added):
 	  Move the ReadTocTask to the new cdrdao module.
diff --git a/examples/readhtoa.py b/examples/readhtoa.py
new file mode 100644
index 0000000..c63dc78
--- /dev/null
+++ b/examples/readhtoa.py
@@ -0,0 +1,63 @@
+# -*- Mode: Python -*-
+# vi:si:et:sw=4:sts=4:ts=4
+
+import os
+import tempfile
+import shutil
+
+from morituri.common import task, checksum, log
+from morituri.program import cdrdao, cdparanoia
+
+import gobject
+gobject.threads_init()
+
+def main():
+    log.init()
+    runner = task.SyncRunner()
+    t = cdrdao.ReadTOCTask()
+    runner.run(t)
+
+    # now check if we have a hidden track one audio
+    track = t.toc.tracks[0]
+    try:
+        index = track.getIndex(0)
+    except KeyError:
+        print 'No Hidden Track One Audio found.'
+        return
+
+    start = index[0]
+    stop, _ = track.getIndex(1)
+    print 'Found Hidden Track One Audio from frame %d to %d' % (start, stop)
+        
+    # rip it
+    
+    checksums = []
+
+    for i in range(2):
+        fd, path = tempfile.mkstemp(suffix='.morituri', dir=os.getcwd())
+        os.close(fd)
+
+        t = cdparanoia.ReadTrackTask(path, start, stop - 1, offset=0)
+        if i == 1:
+            t.description = 'Verifying track...'
+
+        runner.run(t)
+
+        t = checksum.CRC32Task(path)
+        runner.run(t)
+
+        if i == 0:
+            os.unlink(path)
+
+        checksums.append(t.checksum)
+
+    print 'runner done'
+    if checksums[0] == checksums[1]:
+        print 'Checksums match'
+        shutil.move(path, 'track00.wav')
+    else:
+        print 'Checksums did not match'
+        os.unlink(path)
+
+
+main()

-- 
morituri packaging



More information about the pkg-multimedia-commits mailing list