* morituri/common/drive.py:

* morituri/rip/drive.py:
	  Extract getDeviceInfo function.
This commit is contained in:
Thomas Vander Stichele
2012-12-02 12:04:45 +00:00
parent 638d2bc7a0
commit 18c99b6e77
3 changed files with 21 additions and 3 deletions

View File

@@ -1,3 +1,9 @@
2012-12-02 Thomas Vander Stichele <thomas at apestaart dot org>
* morituri/common/drive.py:
* morituri/rip/drive.py:
Extract getDeviceInfo function.
2012-12-02 Thomas Vander Stichele <thomas at apestaart dot org>
* morituri/common/config.py (added):

View File

@@ -58,3 +58,15 @@ def _getAllDevicePathsStatic():
ret.append(c)
return ret
def getDeviceInfo(path):
try:
import cdio
except ImportError:
return None
device = cdio.Device(path)
ok, vendor, model, release = device.get_hwinfo()
return (vendor, model, release)

View File

@@ -40,12 +40,12 @@ class List(logcommand.LogCommand):
try:
import cdio
except ImportError:
print 'Install pycdio for vendor/model/release detection.'
self.stdout.write(
'Install pycdio for vendor/model/release detection.\n')
return
for path in paths:
device = cdio.Device(path)
ok, vendor, model, release = device.get_hwinfo()
vendor, model, release = drive.getDeviceInfo(path)
print "drive: %s, vendor: %s, model: %s, release: %s" % (
path, vendor, model, release)