diff --git a/ChangeLog b/ChangeLog index a72f988..c3b4298 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2010-12-30 Thomas Vander Stichele + + * morituri/common/program.py: + * morituri/rip/cd.py: + Add load and eject device. Do so before and after ripping. + 2010-11-14 Thomas Vander Stichele patch by: Loïc Minier diff --git a/morituri/common/program.py b/morituri/common/program.py index d5e3bdf..ef03add 100644 --- a/morituri/common/program.py +++ b/morituri/common/program.py @@ -173,6 +173,18 @@ class Program(log.Loggable): 'result') return path + def loadDevice(self, device): + """ + Load the given device. + """ + os.system('eject -t %s' % device) + + def ejectDevice(self, device): + """ + Eject the given device. + """ + os.system('eject %s' % device) + def unmountDevice(self, device): """ Unmount the given device if it is mounted, as happens with automounted diff --git a/morituri/rip/cd.py b/morituri/rip/cd.py index 5a3e6bb..8b64811 100644 --- a/morituri/rip/cd.py +++ b/morituri/rip/cd.py @@ -88,6 +88,7 @@ Discs are named according to the disc template: default, "', '".join(encode.PROFILES.keys())), default=default) + def handleOptions(self, options): options.track_template = options.track_template.decode('utf-8') options.disc_template = options.disc_template.decode('utf-8') @@ -103,6 +104,7 @@ Discs are named according to the disc template: device = self.parentCommand.options.device print 'Checking device', device + prog.loadDevice(device) prog.unmountDevice(device) # first, read the normal TOC, which is fast @@ -289,7 +291,7 @@ See http://sourceforge.net/tracker/?func=detail&aid=604751&group_id=2171&atid=1 print 'Album not found in AccurateRip database' if responses: - print '%d AccurateRip responses found' % len(responses) + print '%d AccurateRip reponses found' % len(responses) if responses[0].cddbDiscId != itable.getCDDBDiscId(): print "AccurateRip response discid different: %s" % \ @@ -304,6 +306,8 @@ See http://sourceforge.net/tracker/?func=detail&aid=604751&group_id=2171&atid=1 logger = result.getLogger() prog.writeLog(discName, logger) + prog.ejectDevice(device) + class CD(logcommand.LogCommand): summary = "handle CD's"