[SCM] morituri/master: * examples/readtoc.py (added): Add an example to read the TOC, not finished yet.

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


The following commit has been merged in the master branch:
commit a7e3779473a8c549f33654645fc940726ec7f478
Author: Thomas Vander Stichele <thomas (at) apestaart (dot) org>
Date:   Sun Apr 19 17:26:33 2009 +0000

    	* examples/readtoc.py (added):
    	  Add an example to read the TOC, not finished yet.

diff --git a/ChangeLog b/ChangeLog
index 5903081..e6ffc18 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2009-04-19  Thomas Vander Stichele  <thomas at apestaart dot org>
 
+	* examples/readtoc.py (added):
+	  Add an example to read the TOC, not finished yet.
+
+2009-04-19  Thomas Vander Stichele  <thomas at apestaart dot org>
+
 	* morituri/extern (added):
 	* morituri/extern/__init__.py (added):
 	* morituri/extern/asyncsub.py (added):
diff --git a/examples/readtoc.py b/examples/readtoc.py
new file mode 100644
index 0000000..115fc71
--- /dev/null
+++ b/examples/readtoc.py
@@ -0,0 +1,41 @@
+# -*- Mode: Python -*-
+# vi:si:et:sw=4:sts=4:ts=4
+
+import os
+import subprocess
+
+from morituri.common import task
+from morituri.extern import asyncsub
+
+class ReadTOCTask(task.Task):
+    """
+    I am a task that reads the TOC of a CD, including pregaps.
+    """
+
+    description = "Reading TOC..."
+
+    def start(self, runner):
+        task.Task.start(self, runner)
+
+        if os.path.exists('/tmp/toc'):
+            os.unlink('/tmp/toc')
+
+        bufsize = 1024
+        self._popen = asyncsub.Popen(["cdrdao", "read-toc", "/tmp/toc"],
+                  bufsize=bufsize,
+                  stdin=subprocess.PIPE, stdout=subprocess.PIPE,
+                  stderr=subprocess.PIPE, close_fds=True)
+
+        self.runner.schedule(1.0, self._read, runner)
+
+    def _read(self, runner):
+        print self._popen.recv_err()
+        self.runner.schedule(1.0, self._read, runner)
+
+
+def main():
+    runner = task.SyncRunner()
+    t = ReadTOCTask()
+    runner.run(t)
+
+main()

-- 
morituri packaging



More information about the pkg-multimedia-commits mailing list