diff --git a/morituri/common/program.py b/morituri/common/program.py index eecf90d..1b7ea61 100644 --- a/morituri/common/program.py +++ b/morituri/common/program.py @@ -101,8 +101,9 @@ class Program(log.Loggable): def getFastToc(self, runner, toc_pickle, device): """ Retrieve the normal TOC table from a toc pickle or the drive. + Also retrieves the cdrdao version - @rtype: L{table.Table} + @rtype: tuple of L{table.Table}, str """ def function(r, t): r.run(t) @@ -132,7 +133,7 @@ class Program(log.Loggable): ptoc.persist(t.table) toc = ptoc.object assert toc.hasTOC() - return toc + return (toc, version) def getTable(self, runner, cddbdiscid, mbdiscid, device): """ @@ -703,7 +704,8 @@ class Program(log.Loggable): def writeLog(self, discName, logger): logPath = '%s.log' % discName handle = open(logPath, 'w') - handle.write(logger.log(self.result).encode('utf-8')) + log = logger.log(self.result) + handle.write(log.encode('utf-8')) handle.close() self.logPath = logPath diff --git a/morituri/rip/cd.py b/morituri/rip/cd.py index cf03b46..444ee18 100644 --- a/morituri/rip/cd.py +++ b/morituri/rip/cd.py @@ -68,10 +68,8 @@ class _CD(logcommand.LogCommand): self.program.loadDevice(self.device) self.program.unmountDevice(self.device) - version = None - # first, read the normal TOC, which is fast - self.ittoc = self.program.getFastToc(self.runner, + self.ittoc, version = self.program.getFastToc(self.runner, self.options.toc_pickle, self.device) diff --git a/morituri/test/common.py b/morituri/test/common.py index d1aa8d7..97e716e 100644 --- a/morituri/test/common.py +++ b/morituri/test/common.py @@ -26,11 +26,13 @@ def _diff(old, new, desc): raise AssertionError( ("\nError while comparing strings:\n" - "%s") % (output, )) + "%s") % (output.encode('utf-8'), )) def diffStrings(orig, new, desc='input'): + assert type(orig) == type(new) + def _tolines(s): return [line + '\n' for line in s.split('\n')]