From 64d241808abc17780b243763df1f4e9986fa4f4b Mon Sep 17 00:00:00 2001 From: Thomas Vander Stichele Date: Sun, 7 Jun 2009 13:34:41 +0000 Subject: [PATCH] * morituri/rip/drive.py: Make pycdio and cdio optional. --- ChangeLog | 5 +++++ morituri/rip/drive.py | 26 ++++++++++++++++++++++---- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index e81597c..0a1ae04 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-06-07 Thomas Vander Stichele + + * morituri/rip/drive.py: + Make pycdio and cdio optional. + 2009-06-07 Thomas Vander Stichele * morituri/image/table.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 . -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"