* morituri/rip/drive.py:
Make pycdio and cdio optional.
This commit is contained in:
@@ -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>
|
2009-06-07 Thomas Vander Stichele <thomas at apestaart dot org>
|
||||||
|
|
||||||
* morituri/image/table.py:
|
* morituri/image/table.py:
|
||||||
|
|||||||
@@ -20,8 +20,7 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with morituri. If not, see <http://www.gnu.org/licenses/>.
|
# along with morituri. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import pycdio
|
import os
|
||||||
import cdio
|
|
||||||
|
|
||||||
from morituri.common import logcommand
|
from morituri.common import logcommand
|
||||||
|
|
||||||
@@ -29,8 +28,24 @@ class List(logcommand.LogCommand):
|
|||||||
summary = "list drives"
|
summary = "list drives"
|
||||||
|
|
||||||
def do(self, args):
|
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
|
# using FS_AUDIO here only makes it list the drive when an audio cd
|
||||||
# is inserted
|
# is inserted
|
||||||
paths = cdio.get_devices_with_cap(pycdio.FS_MATCH_ALL, False)
|
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" % (
|
print "drive: %s, vendor: %s, model: %s, release: %s" % (
|
||||||
path, vendor, model, release)
|
path, vendor, model, release)
|
||||||
|
|
||||||
|
if not paths:
|
||||||
|
print 'No drives found.'
|
||||||
|
|
||||||
class Drive(logcommand.LogCommand):
|
class Drive(logcommand.LogCommand):
|
||||||
summary = "handle drives"
|
summary = "handle drives"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user