From 1643d1ec507de442eb9e72367334fc7958ad7002 Mon Sep 17 00:00:00 2001 From: Thomas Vander Stichele Date: Sat, 20 Jun 2009 10:57:12 +0000 Subject: [PATCH] * Makefile.am: * misc/pycheckerrc: * morituri/common/accurip.py: * morituri/common/checksum.py: * morituri/common/encode.py: * morituri/image/table.py: * morituri/rip/drive.py: Fix up for pychecker warnings for 2.6 Fix rip drive list, which forgot some modules. --- ChangeLog | 12 ++++++++++++ Makefile.am | 3 ++- misc/pycheckerrc | 4 ++++ morituri/common/accurip.py | 6 +++--- morituri/common/checksum.py | 6 +++--- morituri/common/encode.py | 4 ++-- morituri/image/table.py | 8 ++++---- morituri/rip/drive.py | 8 +++++++- 8 files changed, 37 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0c3cfa9..107cb5d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2009-06-20 Thomas Vander Stichele + + * Makefile.am: + * misc/pycheckerrc: + * morituri/common/accurip.py: + * morituri/common/checksum.py: + * morituri/common/encode.py: + * morituri/image/table.py: + * morituri/rip/drive.py: + Fix up for pychecker warnings for 2.6 + Fix rip drive list, which forgot some modules. + 2009-06-16 Thomas Vander Stichele * morituri/rip/main.py: diff --git a/Makefile.am b/Makefile.am index 49bdecd..3fa9a16 100644 --- a/Makefile.am +++ b/Makefile.am @@ -26,7 +26,8 @@ PYCHECKER_WHITELIST = \ morituri/*/*.py PYCHECKER_BLACKLIST = \ - morituri/extern/asyncsub.py + morituri/extern/asyncsub.py \ + morituri/extern/log/log.py release: dist make $(PACKAGE)-$(VERSION).tar.bz2.md5 diff --git a/misc/pycheckerrc b/misc/pycheckerrc index 354b201..8f63c7b 100644 --- a/misc/pycheckerrc +++ b/misc/pycheckerrc @@ -181,6 +181,8 @@ blacklist = [ '_interface_coptimizations', #warning: couldn't find real module for class xml.parsers.expat.ExpatError (module name: xml.parsers.expat) 'xml.parsers.expat', + 'unittest', + 'morituri.extern.log.log', ] # ignore global variables not used if name is one of these values @@ -237,4 +239,6 @@ suppressions = { 'twisted.internet.threads.deferToThread' : "no-shadow", # FIXME: doing this inline doesn't seem to work 'flumotion.component.producers.looper.admin_gtk.py': 'no-classattr', + # Catching a non-Exception object (KeyboardInterrupt) + 'unittest': 'no-badexcept', } diff --git a/morituri/common/accurip.py b/morituri/common/accurip.py index b034338..7e6e7c1 100644 --- a/morituri/common/accurip.py +++ b/morituri/common/accurip.py @@ -93,10 +93,10 @@ def getAccurateRipResponses(data): while data: trackCount = struct.unpack("B", data[0])[0] - bytes = 1 + 12 + trackCount * (1 + 8) + nbytes = 1 + 12 + trackCount * (1 + 8) - ret.append(AccurateRipResponse(data[:bytes])) - data = data[bytes:] + ret.append(AccurateRipResponse(data[:nbytes])) + data = data[nbytes:] return ret diff --git a/morituri/common/checksum.py b/morituri/common/checksum.py index b7bb1f6..84996b6 100644 --- a/morituri/common/checksum.py +++ b/morituri/common/checksum.py @@ -82,9 +82,9 @@ class ChecksumTask(task.Task): if self._frameLength < 0: self.debug('query duration') - length, format = sink.query_duration(gst.FORMAT_DEFAULT) + length, qformat = sink.query_duration(gst.FORMAT_DEFAULT) # wavparse 0.10.14 returns in bytes - if format == gst.FORMAT_BYTES: + if qformat == gst.FORMAT_BYTES: self.debug('query returned in BYTES format') length /= 4 self.debug('total length: %r', length) @@ -301,7 +301,7 @@ class TRMTask(task.Task): gst.debug('query duration') sink = self._pipeline.get_by_name('sink') - self._length, format = self._pipeline.query_duration(gst.FORMAT_TIME) + self._length, qformat = self._pipeline.query_duration(gst.FORMAT_TIME) gst.debug('total length: %r' % self._length) gst.debug('scheduling setting to play') # since set_state returns non-False, adding it as timeout_add diff --git a/morituri/common/encode.py b/morituri/common/encode.py index 9fc52df..f5ddc17 100644 --- a/morituri/common/encode.py +++ b/morituri/common/encode.py @@ -138,9 +138,9 @@ class EncodeTask(task.Task): # get length self.debug('query duration') - length, format = muxer.query_duration(gst.FORMAT_DEFAULT) + length, qformat = muxer.query_duration(gst.FORMAT_DEFAULT) # wavparse 0.10.14 returns in bytes - if format == gst.FORMAT_BYTES: + if qformat == gst.FORMAT_BYTES: self.debug('query returned in BYTES format') length /= 4 self.debug('total length: %r', length) diff --git a/morituri/image/table.py b/morituri/image/table.py index 75cdb5c..8c1b4da 100644 --- a/morituri/image/table.py +++ b/morituri/image/table.py @@ -184,10 +184,10 @@ class Table(object, log.Loggable): end = self.tracks[number].getIndex(1).absolute - 1 # if on a session border, subtract the session leadin - this = self.tracks[number - 1] - next = self.tracks[number] - if next.session > this.session: - gap = self._getSessionGap(next.session) + thisTrack = self.tracks[number - 1] + nextTrack = self.tracks[number] + if nextTrack.session > thisTrack.session: + gap = self._getSessionGap(nextTrack.session) end -= gap return end diff --git a/morituri/rip/drive.py b/morituri/rip/drive.py index f36adc3..0c97efa 100644 --- a/morituri/rip/drive.py +++ b/morituri/rip/drive.py @@ -22,7 +22,7 @@ import os -from morituri.common import logcommand +from morituri.common import logcommand, drive class List(logcommand.LogCommand): summary = "list drives" @@ -37,6 +37,12 @@ class List(logcommand.LogCommand): return + try: + import cdio + except ImportError: + print 'Install pycdio for vendora/model/release detection.' + return + for path in paths: device = cdio.Device(path) ok, vendor, model, release = device.get_hwinfo()