diff --git a/morituri/common/checksum.py b/morituri/common/checksum.py index 542e795..0625d8d 100644 --- a/morituri/common/checksum.py +++ b/morituri/common/checksum.py @@ -150,7 +150,8 @@ class ChecksumTask(log.Loggable, gstreamer.GstPipelineTask): self.debug('stopped') if not self._last: # see http://bugzilla.gnome.org/show_bug.cgi?id=578612 - self.debug('not a single buffer gotten, setting exception EmptyError') + self.debug( + 'not a single buffer gotten, setting exception EmptyError') self.setException(common.EmptyError('not a single buffer gotten')) else: self._checksum = self._checksum % 2 ** 32 diff --git a/morituri/common/common.py b/morituri/common/common.py index a1fa781..3c8b46f 100644 --- a/morituri/common/common.py +++ b/morituri/common/common.py @@ -300,6 +300,7 @@ def shrinkPath(path): path = os.path.join(*parts) return path + def getRealPath(refPath, filePath): """ Translate a .cue or .toc's FILE to an existing path. @@ -339,6 +340,7 @@ def getRealPath(refPath, filePath): raise KeyError("Cannot find file for %r" % filePath) + def getRelativePath(targetPath, collectionPath): """ Get a relative path from the directory of collectionPath to diff --git a/morituri/common/musicbrainz.py b/morituri/common/musicbrainz.py index cb519b1..f18f31b 100644 --- a/morituri/common/musicbrainz.py +++ b/morituri/common/musicbrainz.py @@ -90,7 +90,8 @@ def _getMetadata(release): metadata.release = release.getEarliestReleaseDate() metadata.mbid = urlparse.urlparse(release.id)[2].split("/")[-1] - metadata.mbidArtist = urlparse.urlparse(release.artist.id)[2].split("/")[-1] + metadata.mbidArtist = urlparse.urlparse( + release.artist.id)[2].split("/")[-1] metadata.url = release.getId() tainted = False @@ -131,7 +132,8 @@ def _getMetadata(release): return metadata -# see http://bugs.musicbrainz.org/browser/python-musicbrainz2/trunk/examples/ripper.py +# see http://bugs.musicbrainz.org/browser/python-musicbrainz2/trunk/examples/ +# ripper.py def musicbrainz(discid): diff --git a/morituri/common/musicbrainzngs.py b/morituri/common/musicbrainzngs.py index 83cda8c..743438b 100644 --- a/morituri/common/musicbrainzngs.py +++ b/morituri/common/musicbrainzngs.py @@ -204,7 +204,8 @@ def _getMetadata(release, discid): return metadata -# see http://bugs.musicbrainz.org/browser/python-musicbrainz2/trunk/examples/ripper.py +# see http://bugs.musicbrainz.org/browser/python-musicbrainz2/trunk/examples/ +# ripper.py def musicbrainz(discid, record=False): diff --git a/morituri/common/program.py b/morituri/common/program.py index 6a6d2c8..1c970f0 100644 --- a/morituri/common/program.py +++ b/morituri/common/program.py @@ -198,7 +198,8 @@ class Program(log.Loggable): if i > 0: try: v['a'] = filterForPath(self.metadata.tracks[i - 1].artist) - v['s'] = filterForPath(self.metadata.tracks[i - 1].sortName) + v['s'] = filterForPath( + self.metadata.tracks[i - 1].sortName) v['n'] = filterForPath(self.metadata.tracks[i - 1].title) except IndexError, e: print 'ERROR: no track %d found, %r' % (i, e) @@ -359,7 +360,8 @@ class Program(log.Loggable): ret = gst.TagList() - # gst-python 0.10.15.1 does not handle unicode -> utf8 string conversion + # gst-python 0.10.15.1 does not handle unicode -> utf8 string + # conversion # see http://bugzilla.gnome.org/show_bug.cgi?id=584445 if self.metadata and self.metadata.various: ret["album-artist"] = albumArtist.encode('utf-8') @@ -380,8 +382,8 @@ class Program(log.Loggable): # 0.10.15.1 # FIXME: The dates are strings and must have the format 'YYYY', # 'YYYY-MM' or 'YYYY-MM-DD'. - # GstDate expects a full date, so default to Jan and 1st if MM and DD - # are missing + # GstDate expects a full date, so default to + # Jan and 1st if MM and DD are missing date = self.metadata.release if date: log.debug('metadata', diff --git a/morituri/configure/uninstalled.py.in b/morituri/configure/uninstalled.py.in index 721e1a3..7e9aea3 100644 --- a/morituri/configure/uninstalled.py.in +++ b/morituri/configure/uninstalled.py.in @@ -6,6 +6,7 @@ import os __thisdir = os.path.dirname(os.path.abspath(__file__)) + def get(): return { 'isinstalled': False, diff --git a/morituri/image/toc.py b/morituri/image/toc.py index 2ca68a5..55f902d 100644 --- a/morituri/image/toc.py +++ b/morituri/image/toc.py @@ -110,7 +110,7 @@ class TocFile(object, log.Loggable): trackNumber = 0 indexNumber = 0 absoluteOffset = 0 # running absolute offset of where each track starts - relativeOffset = 0 # running relative offset, relative to counter source + relativeOffset = 0 # running relative offset, relative to counter src currentLength = 0 # accrued during TRACK record parsing, current track totalLength = 0 # accrued during TRACK record parsing, total disc pregapLength = 0 # length of the pre-gap, current track @@ -163,7 +163,8 @@ class TocFile(object, log.Loggable): # FIXME: why not set absolute offsets too ? currentTrack.index(1, path=currentFile.path, absolute=absoluteOffset + pregapLength, - relative=relativeOffset + pregapLength, counter=counter) + relative=relativeOffset + pregapLength, + counter=counter) self.debug('track %d, added index %r', currentTrack.number, currentTrack.getIndex(1)) @@ -223,7 +224,8 @@ class TocFile(object, log.Loggable): if not currentFile or filePath != currentFile.path: counter += 1 relativeOffset = 0 - self.debug('track %d, switched to new FILE, increased counter to %d', + self.debug('track %d, switched to new FILE, ' + 'increased counter to %d', trackNumber, counter) currentFile = File(filePath, start, length) #absoluteOffset += common.msfToFrames(start) @@ -240,7 +242,8 @@ class TocFile(object, log.Loggable): if not currentFile or filePath != currentFile.path: counter += 1 relativeOffset = 0 - self.debug('track %d, switched to new FILE, increased counter to %d', + self.debug('track %d, switched to new FILE, ' + 'increased counter to %d', trackNumber, counter) # FIXME: assume that a MODE2_FORM_MIX track always starts at 0 currentFile = File(filePath, 0, length) diff --git a/morituri/program/cdparanoia.py b/morituri/program/cdparanoia.py index 31ba244..1b654f2 100644 --- a/morituri/program/cdparanoia.py +++ b/morituri/program/cdparanoia.py @@ -525,7 +525,8 @@ class ReadVerifyTrackTask(log.Loggable, task.MultiSeparateTask): self.path = common.shrinkPath(self.path) shutil.move(self._tmppath, self.path) except Exception, e: - self.debug('Exception while moving to final path %r: %r', + self.debug('Exception while moving to final path %r: ' + '%r', self.path, log.getExceptionMessage(e)) self.exception = e else: @@ -537,7 +538,8 @@ class ReadVerifyTrackTask(log.Loggable, task.MultiSeparateTask): task.MultiSeparateTask.stop(self) -_VERSION_RE = re.compile("^cdparanoia (?P.+) release (?P.+) \(.*\)") +_VERSION_RE = re.compile( + "^cdparanoia (?P.+) release (?P.+) \(.*\)") def getCdparanoiaVersion(): diff --git a/morituri/result/logger.py b/morituri/result/logger.py index 7168507..1d51c24 100644 --- a/morituri/result/logger.py +++ b/morituri/result/logger.py @@ -26,6 +26,7 @@ from morituri.common import common from morituri.configure import configure from morituri.result import result + class MorituriLogger(result.Logger): def log(self, ripResult, epoch=time.time()): diff --git a/morituri/result/result.py b/morituri/result/result.py index 58bb7e2..543706f 100644 --- a/morituri/result/result.py +++ b/morituri/result/result.py @@ -141,6 +141,7 @@ class Logger(object): # A setuptools-like entry point + class EntryPoint(object): name = 'morituri' diff --git a/morituri/rip/cd.py b/morituri/rip/cd.py index 90f4333..b398be5 100644 --- a/morituri/rip/cd.py +++ b/morituri/rip/cd.py @@ -75,8 +75,7 @@ Log files will log the path to tracks relative to this directory. default='morituri', help="logger to use " "(default '%default', choose from '" + - "', '".join(loggers) + "')" - ) + "', '".join(loggers) + "')") # FIXME: get from config default = 0 self.parser.add_option('-o', '--offset', @@ -86,8 +85,7 @@ Log files will log the path to tracks relative to this directory. self.parser.add_option('-O', '--output-directory', action="store", dest="output_directory", help="output directory " - "(defaults to absolute path to current directory) " - ) + "(defaults to absolute path to current directory) ") # FIXME: have a cache of these pickles somewhere self.parser.add_option('-T', '--toc-pickle', action="store", dest="toc_pickle", @@ -150,10 +148,10 @@ Log files will log the path to tracks relative to this directory. from pkg_resources import parse_version as V # we've built a cdrdao 1.2.3rc2 modified package with the patch if V(version) < V('1.2.3rc2p1'): - self.stdout.write(''' -Warning: cdrdao older than 1.2.3 has a pre-gap length bug. -See http://sourceforge.net/tracker/?func=detail&aid=604751&group_id=2171&atid=102171 -''') + self.stdout.write('Warning: cdrdao older than 1.2.3 has a ' + 'pre-gap length bug.\n' + 'See http://sourceforge.net/tracker/?func=detail' + '&aid=604751&group_id=2171&atid=102171\n') ptoc.persist(t.table) ittoc = ptoc.object assert ittoc.hasTOC() diff --git a/morituri/test/test_common_common.py b/morituri/test/test_common_common.py index 398222f..e192ad4 100644 --- a/morituri/test/test_common_common.py +++ b/morituri/test/test_common_common.py @@ -11,18 +11,28 @@ from morituri.test import common as tcommon class ShrinkTestCase(tcommon.TestCase): def testSufjan(self): - path = u'morituri/Sufjan Stevens - Illinois/02. Sufjan Stevens - The Black Hawk War, or, How to Demolish an Entire Civilization and Still Feel Good About Yourself in the Morning, or, We Apologize for the Inconvenience but You\'re Going to Have to Leave Now, or, "I Have Fought the Big Knives and Will Continue to Fight Them Until They Are Off Our Lands!".flac' + path = (u'morituri/Sufjan Stevens - Illinois/02. Sufjan Stevens - ' + 'The Black Hawk War, or, How to Demolish an Entire ' + 'Civilization and Still Feel Good About Yourself in the ' + 'Morning, or, We Apologize for the Inconvenience but ' + 'You\'re Going to Have to Leave Now, or, "I Have Fought ' + 'the Big Knives and Will Continue to Fight Them Until They ' + 'Are Off Our Lands!".flac') shorter = common.shrinkPath(path) self.failUnless(os.path.splitext(path)[0].startswith( os.path.splitext(shorter)[0])) self.failIfEquals(path, shorter) + class FramesTestCase(tcommon.TestCase): + def testFrames(self): self.assertEquals(common.framesToHMSF(123456), '00:27:26.06') + class FormatTimeTestCase(tcommon.TestCase): + def testFormatTime(self): self.assertEquals(common.formatTime(7202), '02:00:02.000') diff --git a/morituri/test/test_image_table.py b/morituri/test/test_image_table.py index de01407..5986b6e 100644 --- a/morituri/test/test_image_table.py +++ b/morituri/test/test_image_table.py @@ -9,7 +9,9 @@ from morituri.test import common as tcommon def h(i): return "0x%08x" % i + class TrackTestCase(tcommon.TestCase): + def testRepr(self): track = table.Track(1) self.assertEquals(repr(track), "") @@ -17,6 +19,7 @@ class TrackTestCase(tcommon.TestCase): track.index(1, 100) self.failUnless(repr(track.indexes[1]).startswith('