From 3093d50986dbc6ba79d65c861c714cfb12288ef9 Mon Sep 17 00:00:00 2001 From: Thomas Vander Stichele Date: Sat, 6 Aug 2011 12:26:04 +0000 Subject: [PATCH] * morituri/rip/debug.py: Add checksum task for debugging. --- ChangeLog | 5 +++++ morituri/rip/debug.py | 29 +++++++++++++++++++++++++++-- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index fcc9e3b..904d674 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-08-06 Thomas Vander Stichele + + * morituri/rip/debug.py: + Add checksum task for debugging. + 2011-08-05 Thomas Vander Stichele * morituri/common/checksum.py: diff --git a/morituri/rip/debug.py b/morituri/rip/debug.py index 812e2fb..116c089 100644 --- a/morituri/rip/debug.py +++ b/morituri/rip/debug.py @@ -24,6 +24,32 @@ from morituri.common import logcommand from morituri.extern.task import task, gstreamer +class Checksum(logcommand.LogCommand): + + summary = "run a checksum task" + + def addOptions(self): + # here to avoid import gst eating our options + from morituri.common import checksum + + def do(self, args): + try: + fromPath = unicode(args[0]) + except IndexError: + self.stdout.write('Please specify an input file.\n') + return 3 + + runner = task.SyncRunner() + + from morituri.common import checksum + checksumtask = checksum.CRC32Task(fromPath) + + runner.run(checksumtask) + + self.stdout.write('Checksum: %08x\n' % checksumtask.checksum) + + + class Encode(logcommand.LogCommand): summary = "run an encode task" @@ -59,10 +85,9 @@ class Encode(logcommand.LogCommand): runner.run(encodetask) - class Debug(logcommand.LogCommand): summary = "debug internals" - subCommandClasses = [Encode, ] + subCommandClasses = [Checksum, Encode, ]