From d7848cd34c5eb5968a25b51cee8509ab6f15fa0a Mon Sep 17 00:00:00 2001 From: Velo Superman Date: Fri, 1 Mar 2013 19:32:15 +0100 Subject: [PATCH 1/3] break into two lines to separate logger problems from morituri --- morituri/common/program.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/morituri/common/program.py b/morituri/common/program.py index 5c49d86..5baf0e6 100644 --- a/morituri/common/program.py +++ b/morituri/common/program.py @@ -698,7 +698,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 From a2afe796441663c1b94dfdbd39e568a439ee5262 Mon Sep 17 00:00:00 2001 From: Velo Superman Date: Sun, 3 Mar 2013 14:19:23 +0100 Subject: [PATCH 2/3] handle encoding properly when outputting diff --- morituri/test/common.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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')] From 7e3d7f0ab77bb6d8d3a967f4ce31c6b4ba23c89f Mon Sep 17 00:00:00 2001 From: Velo Superman Date: Sun, 3 Mar 2013 17:55:10 +0100 Subject: [PATCH 3/3] return cdrdao version used --- morituri/common/program.py | 5 +++-- morituri/rip/cd.py | 4 +--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/morituri/common/program.py b/morituri/common/program.py index 5baf0e6..bac1d69 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): """ diff --git a/morituri/rip/cd.py b/morituri/rip/cd.py index 436b6ba..e6e888a 100644 --- a/morituri/rip/cd.py +++ b/morituri/rip/cd.py @@ -64,10 +64,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)