* morituri/rip/drive.py:

Make pycdio and cdio optional.
This commit is contained in:
Thomas Vander Stichele
2009-06-07 13:34:41 +00:00
parent 247d27db6a
commit 64d241808a
2 changed files with 27 additions and 4 deletions

View File

@@ -1,3 +1,8 @@
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:

View File

@@ -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"