[SCM] morituri/master: * morituri/rip/drive.py: Make pycdio and cdio optional.

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


The following commit has been merged in the master branch:
commit 64d241808abc17780b243763df1f4e9986fa4f4b
Author: Thomas Vander Stichele <thomas (at) apestaart (dot) org>
Date:   Sun Jun 7 13:34:41 2009 +0000

    	* morituri/rip/drive.py:
    	  Make pycdio and cdio optional.

diff --git a/ChangeLog b/ChangeLog
index e81597c..0a1ae04 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2009-06-07  Thomas Vander Stichele  <thomas at apestaart dot org>
 
+	* morituri/rip/drive.py:
+	  Make pycdio and cdio optional.
+
+2009-06-07  Thomas Vander Stichele  <thomas at apestaart dot org>
+
 	* morituri/image/table.py:
 	  Add getPregap() method.
 	* morituri/rip/cd.py:
diff --git a/morituri/rip/drive.py b/morituri/rip/drive.py
index 94b99e8..c854463 100644
--- a/morituri/rip/drive.py
+++ b/morituri/rip/drive.py
@@ -20,8 +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 pycdio
-import cdio
+import os
 
 from morituri.common import logcommand
 
@@ -29,8 +28,24 @@ class List(logcommand.LogCommand):
     summary = "list drives"
 
     def do(self, args):
-        print 'getting paths'
-        
+        try:
+            import pycdio
+            import cdio
+        except ImportError, e:
+            self.info('pycdio not installed, cannot list drives')
+            found = False
+            for c in ['/dev/cdrom', '/dev/cdrecorder']:
+                if os.path.exists(c):
+                    print "drive: %s", c
+                    found = True
+
+            if not found:
+                print 'No drives found.'
+                print 'Create /dev/cdrom if you have a CD drive, '
+                print 'or install pycdio for better detection.'
+
+            return
+
         # using FS_AUDIO here only makes it list the drive when an audio cd
         # is inserted
         paths = cdio.get_devices_with_cap(pycdio.FS_MATCH_ALL, False)
@@ -40,6 +55,9 @@ class List(logcommand.LogCommand):
             print "drive: %s, vendor: %s, model: %s, release: %s" % (
                 path, vendor, model, release)
 
+        if not paths:
+            print 'No drives found.'
+
 class Drive(logcommand.LogCommand):
     summary = "handle drives"
 

-- 
morituri packaging



More information about the pkg-multimedia-commits mailing list