* morituri/common/program.py:

* morituri/rip/offset.py:
	  When finding the offset, also load and possibly unmount, resolving
	  to the real path for the device.
This commit is contained in:
Thomas Vander Stichele
2011-03-22 17:31:36 +00:00
parent 82edb39c03
commit 6a8355b109
3 changed files with 22 additions and 2 deletions

View File

@@ -1,3 +1,10 @@
2011-03-22 Thomas Vander Stichele <thomas at apestaart dot org>
* morituri/common/program.py:
* morituri/rip/offset.py:
When finding the offset, also load and possibly unmount, resolving
to the real path for the device.
2011-03-20 Thomas Vander Stichele <thomas at apestaart dot org> 2011-03-20 Thomas Vander Stichele <thomas at apestaart dot org>
* morituri/common/encode.py: * morituri/common/encode.py:

View File

@@ -189,7 +189,11 @@ class Program(log.Loggable):
""" """
Unmount the given device if it is mounted, as happens with automounted Unmount the given device if it is mounted, as happens with automounted
data tracks. data tracks.
If the given device is a symlink, the target will be checked.
""" """
device = os.path.realpath(device)
self.debug('possibly unmount real path %r' % device)
proc = open('/proc/mounts').read() proc = open('/proc/mounts').read()
if device in proc: if device in proc:
print 'Device %s is mounted, unmounting' % device print 'Device %s is mounted, unmounting' % device

View File

@@ -26,7 +26,7 @@ import tempfile
import gobject import gobject
gobject.threads_init() gobject.threads_init()
from morituri.common import logcommand, task, accurip, drive from morituri.common import logcommand, task, accurip, drive, program
from morituri.image import image from morituri.image import image
from morituri.program import cdrdao, cdparanoia from morituri.program import cdrdao, cdparanoia
@@ -86,10 +86,19 @@ CD in the AccurateRip database."""
def do(self, args): def do(self, args):
prog = program.Program()
runner = task.SyncRunner() runner = task.SyncRunner()
device = self.options.device
# if necessary, load and unmount
print 'Checking device', device
prog.loadDevice(device)
prog.unmountDevice(device)
# first get the Table Of Contents of the CD # first get the Table Of Contents of the CD
t = cdrdao.ReadTOCTask(device=self.options.device) t = cdrdao.ReadTOCTask(device=device)
try: try:
runner.run(t) runner.run(t)