From afd638fa4bd1b752cf00b230d1c6c74f3c146042 Mon Sep 17 00:00:00 2001 From: Thomas Vander Stichele Date: Sun, 25 Aug 2013 17:18:04 +0200 Subject: [PATCH] add debug resultcache cue command to output a cue from a cached result --- morituri/rip/debug.py | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/morituri/rip/debug.py b/morituri/rip/debug.py index 369be4c..00c1a12 100644 --- a/morituri/rip/debug.py +++ b/morituri/rip/debug.py @@ -25,6 +25,23 @@ from morituri.result import result from morituri.common import task, cache +class RCCue(logcommand.LogCommand): + + name = "cue" + summary = "write a cue file for the cached result" + + def do(self, args): + self._cache = cache.ResultCache() + + persisted = self._cache.getRipResult(args[0], create=False) + + if not persisted: + self.stderr.write( + 'Could not find a result for cddb disc id %s\n' % args[0]) + return 3 + + self.stdout.write(persisted.object.table.cue().encode('utf-8')) + class RCList(logcommand.LogCommand): @@ -85,14 +102,14 @@ class RCLog(logcommand.LogCommand): logger = klazz() self.stdout.write(logger.log(persisted.object).encode('utf-8')) - + class ResultCache(logcommand.LogCommand): summary = "debug result cache" aliases = ['rc', ] - subCommandClasses = [RCList, RCLog, ] + subCommandClasses = [RCCue, RCList, RCLog, ] class Checksum(logcommand.LogCommand):