From 5b1e2c88a4eca1917abd76e2cd8f912873f86be3 Mon Sep 17 00:00:00 2001 From: Thomas Vander Stichele Date: Sun, 25 Nov 2012 19:54:15 +0000 Subject: [PATCH] patch by: mustbenice * morituri/common/program.py: * morituri/program/cdparanoia.py: * morituri/result/logger.py: * morituri/result/result.py: Calculate speed of reading track. Output Test and Copy speed per track in log. --- ChangeLog | 11 +++++++++++ morituri/common/program.py | 2 ++ morituri/program/cdparanoia.py | 10 ++++++++++ morituri/result/logger.py | 8 ++++++++ morituri/result/result.py | 2 ++ 5 files changed, 33 insertions(+) diff --git a/ChangeLog b/ChangeLog index 1cefa90..dc6402a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2012-11-25 Thomas Vander Stichele + + patch by: mustbenice + + * morituri/common/program.py: + * morituri/program/cdparanoia.py: + * morituri/result/logger.py: + * morituri/result/result.py: + Calculate speed of reading track. + Output Test and Copy speed per track in log. + 2012-11-25 Thomas Vander Stichele * morituri.spec.in: diff --git a/morituri/common/program.py b/morituri/common/program.py index eb9c0a1..049884d 100644 --- a/morituri/common/program.py +++ b/morituri/common/program.py @@ -474,6 +474,8 @@ class Program(log.Loggable): trackResult.copycrc = t.copychecksum trackResult.peak = t.peak trackResult.quality = t.quality + trackResult.testspeed = t.testspeed + trackResult.copyspeed = t.copyspeed if trackResult.filename != t.path: trackResult.filename = t.path diff --git a/morituri/program/cdparanoia.py b/morituri/program/cdparanoia.py index 0bfe298..dfe1bd3 100644 --- a/morituri/program/cdparanoia.py +++ b/morituri/program/cdparanoia.py @@ -22,6 +22,7 @@ import os import errno +import time import re import stat import shutil @@ -203,6 +204,7 @@ class ReadTrackTask(log.Loggable, task.Task): description = "Reading track" quality = None # set at end of reading + speed = None _MAXERROR = 100 # number of errors detected by parser @@ -237,6 +239,7 @@ class ReadTrackTask(log.Loggable, task.Task): self._offset = offset self._parser = ProgressParser(start, stop) self._device = device + self._start_time = None self._buffer = "" # accumulate characters self._errors = [] @@ -288,6 +291,7 @@ class ReadTrackTask(log.Loggable, task.Task): raise + self._start_time = time.time() self.schedule(1.0, self._read, runner) def _read(self, runner): @@ -339,6 +343,7 @@ class ReadTrackTask(log.Loggable, task.Task): self._done() def _done(self): + end_time = time.time() self.setProgress(1.0) # check if the length matches @@ -368,6 +373,7 @@ class ReadTrackTask(log.Loggable, task.Task): self.exception = ReturnCodeError(self._popen.returncode) self.quality = self._parser.getTrackQuality() + self.speed = (offsetLength / 75) / (end_time - self._start_time) self.stop() return @@ -392,6 +398,8 @@ class ReadVerifyTrackTask(log.Loggable, task.MultiSeparateTask): copychecksum = None peak = None quality = None + testspeed = None + copyspeed = None _tmpwavpath = None _tmppath = None @@ -471,6 +479,8 @@ class ReadVerifyTrackTask(log.Loggable, task.MultiSeparateTask): self.tasks[2].quality) self.peak = self.tasks[4].peak self.debug('peak: %r', self.peak) + self.testspeed = self.tasks[0].speed + self.copyspeed = self.tasks[2].speed self.testchecksum = c1 = self.tasks[1].checksum self.copychecksum = c2 = self.tasks[3].checksum diff --git a/morituri/result/logger.py b/morituri/result/logger.py index 3e0bed1..7168507 100644 --- a/morituri/result/logger.py +++ b/morituri/result/logger.py @@ -105,6 +105,13 @@ class MorituriLogger(result.Logger): lines.append('') lines.append(' Peak level %.1f %%' % (trackResult.peak * 100.0)) + if trackResult.copyspeed: + lines.append(' Extraction Speed (Copy) %.4f X' % ( + trackResult.copyspeed)) + if trackResult.testspeed: + lines.append(' Extraction Speed (Test) %.4f X' % ( + trackResult.testspeed)) + if trackResult.copycrc is not None: lines.append(' Copy CRC %08X' % trackResult.copycrc) if trackResult.testcrc is not None: @@ -116,6 +123,7 @@ class MorituriLogger(result.Logger): else: lines.append(" WARNING: no CRC check done") + if trackResult.accurip: lines.append(' Accurately ripped (confidence %d) [%08X]' % ( trackResult.ARDBConfidence, trackResult.ARCRC)) diff --git a/morituri/result/result.py b/morituri/result/result.py index 1235368..4c4e1cd 100644 --- a/morituri/result/result.py +++ b/morituri/result/result.py @@ -60,6 +60,8 @@ class TrackResult: peak = 0.0 quality = 0.0 + testspeed = 0.0 + copyspeed = 0.0 testcrc = None copycrc = None accurip = False # whether it's in the database