From e75a54ee0149966fd66074ee097750033ac81174 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frederik=20=E2=80=9CFreso=E2=80=9D=20S=2E=20Olesen?= Date: Fri, 19 May 2017 01:05:07 +0200 Subject: [PATCH 1/4] =?UTF-8?q?Fix=20typo=20in=20inline=20comment=20("Ingo?= =?UTF-8?q?re"=20=E2=86=92=20"Ignore")?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- whipper/common/program.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/whipper/common/program.py b/whipper/common/program.py index d4978b5..8dabcce 100644 --- a/whipper/common/program.py +++ b/whipper/common/program.py @@ -125,7 +125,7 @@ class Program: itable = None tdict = {} - # Ingore old cache, since we do not know what offset it used. + # Ignore old cache, since we do not know what offset it used. if type(ptable.object) is dict: tdict = ptable.object From 8ebd329a1973ecb780d11e2ae04a81dd1d9e2f4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frederik=20=E2=80=9CFreso=E2=80=9D=20S=2E=20Olesen?= Date: Fri, 19 May 2017 01:16:45 +0200 Subject: [PATCH 2/4] Fix capitalisation of MusicBrainz everywhere Make MusicBrainz consistently written as "MusicBrainz" and not "musicbrainz" or "Musicbrainz". Doesn't change instances that refer to the Python module or similar. --- whipper/command/cd.py | 2 +- whipper/common/mbngs.py | 4 ++-- whipper/common/program.py | 4 ++-- whipper/image/table.py | 2 +- whipper/test/test_image_table.py | 2 +- whipper/test/test_image_toc.py | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/whipper/command/cd.py b/whipper/command/cd.py index 15af8b0..a5e052f 100644 --- a/whipper/command/cd.py +++ b/whipper/command/cd.py @@ -212,7 +212,7 @@ class _CD(BaseCommand): class Info(_CD): summary = "retrieve information about the currently inserted CD" - description = ("Display musicbrainz, CDDB/FreeDB, and AccurateRip" + description = ("Display MusicBrainz, CDDB/FreeDB, and AccurateRip" "information for the currently inserted CD.") eject = False diff --git a/whipper/common/mbngs.py b/whipper/common/mbngs.py index a066d64..ffdc96f 100644 --- a/whipper/common/mbngs.py +++ b/whipper/common/mbngs.py @@ -19,7 +19,7 @@ # along with whipper. If not, see . """ -Handles communication with the musicbrainz server using NGS. +Handles communication with the MusicBrainz server using NGS. """ import urllib2 @@ -113,7 +113,7 @@ def _record(record, which, name, what): class _Credit(list): """ - I am a representation of an artist-credit in musicbrainz for a disc + I am a representation of an artist-credit in MusicBrainz for a disc or track. """ diff --git a/whipper/common/program.py b/whipper/common/program.py index 8dabcce..113365f 100644 --- a/whipper/common/program.py +++ b/whipper/common/program.py @@ -286,7 +286,7 @@ class Program: """ @type ittoc: L{whipper.image.table.Table} """ - # look up disc on musicbrainz + # look up disc on MusicBrainz self._stdout.write('Disc duration: %s, %d audio tracks\n' % ( common.formatTime(ittoc.duration() / 1000.0), ittoc.getAudioTracks())) @@ -395,7 +395,7 @@ class Program: if (not release and len(deltas.keys()) > 1): self._stdout.write('\n') self._stdout.write('Picked closest match in duration.\n') - self._stdout.write('Others may be wrong in musicbrainz, ' + self._stdout.write('Others may be wrong in MusicBrainz, ' 'please correct.\n') self._stdout.write('Artist : %s\n' % artist.encode('utf-8')) diff --git a/whipper/image/table.py b/whipper/image/table.py index b9909e6..f09386e 100644 --- a/whipper/image/table.py +++ b/whipper/image/table.py @@ -477,7 +477,7 @@ class Table(object): pass - logger.debug('Musicbrainz values: %r', result) + logger.debug('MusicBrainz values: %r', result) return result def getAccurateRipIds(self): diff --git a/whipper/test/test_image_table.py b/whipper/test/test_image_table.py index c0b0038..0b54360 100644 --- a/whipper/test/test_image_table.py +++ b/whipper/test/test_image_table.py @@ -56,7 +56,7 @@ class LadyhawkeTestCase(tcommon.TestCase): # https://musicbrainz.org/cdtoc/attach?toc=1+12+195856+150+ # 15687+31841+51016+66616+81352+99559+116070+133243+149997+161710+ # 177832&tracks=12&id=KnpGsLhvH.lPrNc1PBL21lb9Bg4- - # however, not (yet) in musicbrainz database + # however, not (yet) in MusicBrainz database self.assertEquals(self.table.getMusicBrainzDiscId(), "KnpGsLhvH.lPrNc1PBL21lb9Bg4-") diff --git a/whipper/test/test_image_toc.py b/whipper/test/test_image_toc.py index 0df4109..13bcedf 100644 --- a/whipper/test/test_image_toc.py +++ b/whipper/test/test_image_toc.py @@ -284,7 +284,7 @@ class CapitalMergeTestCase(common.TestCase): def testDuration(self): # this matches track 11 end sector - track 1 start sector on - # musicbrainz + # MusicBrainz # compare to 3rd and 4th value in URL above self.assertEquals(self.table.getFrameLength(), 173530) self.assertEquals(self.table.duration(), 2313733) From 52731e97c04aef214ddea2dd504d2dc7bdf8eae8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frederik=20=E2=80=9CFreso=E2=80=9D=20S=2E=20Olesen?= Date: Fri, 19 May 2017 19:05:11 +0200 Subject: [PATCH 3/4] Remove old, commented out code Some of this seems to be debug code which has been left in, some of it seems to just be old code that was commented out and never put back in and probably just forgotten about. Either way, we use git for a reason, so there's no need for these code snippets to stick around. The code history can be inspected and old code retrieved that way. --- whipper/command/cd.py | 1 - whipper/extern/task/task.py | 1 - whipper/image/cue.py | 1 - whipper/image/image.py | 1 - whipper/image/table.py | 5 ----- whipper/image/toc.py | 3 --- whipper/program/cdparanoia.py | 2 -- whipper/test/test_image_toc.py | 11 ----------- 8 files changed, 25 deletions(-) diff --git a/whipper/command/cd.py b/whipper/command/cd.py index a5e052f..9980bc2 100644 --- a/whipper/command/cd.py +++ b/whipper/command/cd.py @@ -102,7 +102,6 @@ class _CD(BaseCommand): self.runner = task.SyncRunner() # if the device is mounted (data session), unmount it - #self.device = self.parentCommand.options.device self.device = self.options.device sys.stdout.write('Checking device %s\n' % self.device) diff --git a/whipper/extern/task/task.py b/whipper/extern/task/task.py index 30c0ed2..10bbac5 100644 --- a/whipper/extern/task/task.py +++ b/whipper/extern/task/task.py @@ -543,7 +543,6 @@ class SyncRunner(TaskRunner, ITaskListener): sys.stdout.write('\n') sys.stdout.flush() if len(what) > self._longest: - #print; print 'setting longest', self._longest; print self._longest = len(what) def described(self, task, description): diff --git a/whipper/image/cue.py b/whipper/image/cue.py index e8a87ed..31fd0ec 100644 --- a/whipper/image/cue.py +++ b/whipper/image/cue.py @@ -119,7 +119,6 @@ class CueFile(object): state = 'TRACK' trackNumber = int(m.group('track')) - #trackMode = m.group('mode') logger.debug('found track %d', trackNumber) currentTrack = table.Track(trackNumber) diff --git a/whipper/image/image.py b/whipper/image/image.py index b8c1149..815d69f 100644 --- a/whipper/image/image.py +++ b/whipper/image/image.py @@ -203,7 +203,6 @@ class ImageVerifyTask(task.MultiSeparateTask): if taskk.length is None: raise ValueError("Track length was not found; look for " "earlier errors in debug log (set RIP_DEBUG=4)") - # print '%d has length %d' % (trackIndex, taskk.length) index = track.indexes[1] assert taskk.length % common.SAMPLES_PER_FRAME == 0 end = taskk.length / common.SAMPLES_PER_FRAME diff --git a/whipper/image/table.py b/whipper/image/table.py index f09386e..2a2bfbb 100644 --- a/whipper/image/table.py +++ b/whipper/image/table.py @@ -281,8 +281,6 @@ class Table(object): # CD's have a standard lead-in time of 2 seconds # which gets added for CDDB disc id's delta = 2 * common.FRAMES_PER_SECOND - #if self.getTrackStart(1) > 0: - # delta = 0 debug = [str(len(self.tracks))] for track in self.tracks: @@ -293,7 +291,6 @@ class Table(object): n += self._cddbSum(seconds) # the 'real' leadout, not offset by 150 frames - # print 'THOMAS: disc leadout', self.leadout last = self.tracks[-1] leadout = self.getTrackEnd(last.number) + 1 logger.debug('leadout LBA: %d', leadout) @@ -369,7 +366,6 @@ class Table(object): try: offset = values[2 + i] except IndexError: - #print 'track', i - 1, '0 offset' offset = 0 sha.update("%08X" % offset) @@ -727,7 +723,6 @@ class Table(object): # the first cut is the deepest counter = index.counter - #for t in self.tracks: print t, t.indexes logger.debug('absolutizing') while True: track = self.tracks[t - 1] diff --git a/whipper/image/toc.py b/whipper/image/toc.py index 25d00d4..9411a21 100644 --- a/whipper/image/toc.py +++ b/whipper/image/toc.py @@ -311,7 +311,6 @@ class TocFile(object): common.msfToFrames(length)) self._sources.append(counter, absoluteOffset + currentLength, currentFile) - #absoluteOffset += common.msfToFrames(start) currentLength += common.msfToFrames(length) # look for DATAFILE lines @@ -319,7 +318,6 @@ class TocFile(object): if m: filePath = m.group('name') length = m.group('length') - # print 'THOMAS', length logger.debug('FILE %s, length %r', filePath, common.msfToFrames(length)) if not currentFile or filePath != currentFile.path: @@ -332,7 +330,6 @@ class TocFile(object): currentFile = File(filePath, 0, common.msfToFrames(length)) self._sources.append(counter, absoluteOffset + currentLength, currentFile) - #absoluteOffset += common.msfToFrames(start) currentLength += common.msfToFrames(length) diff --git a/whipper/program/cdparanoia.py b/whipper/program/cdparanoia.py index 81e7281..aa5e2f9 100644 --- a/whipper/program/cdparanoia.py +++ b/whipper/program/cdparanoia.py @@ -144,8 +144,6 @@ class ProgressParser: if frameOffset > self.read: delta = frameOffset - self.read if self._nframes and delta != self._nframes: - # print 'THOMAS: Read %d frames more, not %d' % ( - # delta, self._nframes) # my drive either reads 7 or 13 frames pass diff --git a/whipper/test/test_image_toc.py b/whipper/test/test_image_toc.py index 13bcedf..177c5ed 100644 --- a/whipper/test/test_image_toc.py +++ b/whipper/test/test_image_toc.py @@ -62,7 +62,6 @@ class CureTestCase(common.TestCase): self._assertAbsolute(2, 1, 28324) self._assertPath(1, 1, "data.wav") - # self.toc.table.absolutize() self.toc.table.clearFiles() self._assertAbsolute(1, 1, 0) @@ -86,7 +85,6 @@ class CureTestCase(common.TestCase): self._assertRelative(2, 1, None) def testConvertCue(self): - # self.toc.table.absolutize() cue = self.toc.table.cue() ref = self.readCue('cure.cue') common.diffStrings(ref, cue) @@ -155,14 +153,12 @@ class BlocTestCase(common.TestCase): # This disc has a pre-gap, so is a good test for .CUE writing def testConvertCue(self): - #self.toc.table.absolutize() self.failUnless(self.toc.table.hasTOC()) cue = self.toc.table.cue() ref = self.readCue('bloc.cue') common.diffStrings(ref, cue) def testCDDBId(self): - # self.toc.table.absolutize() # cd-discid output: # ad0be00d 13 15370 35019 51532 69190 84292 96826 112527 132448 # 148595 168072 185539 203331 222103 3244 @@ -171,7 +167,6 @@ class BlocTestCase(common.TestCase): def testAccurateRip(self): # we verify it because it has failed in readdisc in the past - # self.toc.table.absolutize() self.assertEquals(self.toc.table.getAccurateRipURL(), 'http://www.accuraterip.com/accuraterip/' 'e/d/2/dBAR-013-001af2de-0105994e-ad0be00d.bin') @@ -216,11 +211,9 @@ class LadyhawkeTestCase(common.TestCase): self.toc = toc.TocFile(self.path) self.toc.parse() self.assertEquals(len(self.toc.table.tracks), 13) - #import code; code.interact(local=locals()) self.failIf(self.toc.table.tracks[-1].audio) def testCDDBId(self): - #self.toc.table.absolutize() self.assertEquals(self.toc.table.getCDDBDiscId(), 'c60af50d') # output from cd-discid: # c60af50d 13 150 15687 31841 51016 66616 81352 99559 116070 133243 @@ -269,7 +262,6 @@ class CapitalMergeTestCase(common.TestCase): self.table.merge(self.toc2.table) def testCDDBId(self): - #self.table.absolutize() self.assertEquals(self.table.getCDDBDiscId(), 'b910140c') # output from cd-discid: # b910140c 12 24320 44855 64090 77885 88095 104020 118245 129255 141765 @@ -336,7 +328,6 @@ class TOTBLTestCase(common.TestCase): self.assertEquals(len(self.toc.table.tracks), 11) def testCDDBId(self): - #self.toc.table.absolutize() self.assertEquals(self.toc.table.getCDDBDiscId(), '810b7b0b') @@ -440,5 +431,3 @@ class SurferRosaTestCase(common.TestCase): self.assertEquals(t.getIndex(1).absolute, 111257) self.assertEquals(t.getIndex(2).relative, 111225 + 3370) self.assertEquals(t.getIndex(2).absolute, 111257 + 3370) - -# print self.toc.table.cue() From b4539d1f80150b29fdf994ca58287b04c61b059e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frederik=20=E2=80=9CFreso=E2=80=9D=20S=2E=20Olesen?= Date: Fri, 19 May 2017 19:07:16 +0200 Subject: [PATCH 4/4] Change "THOMAS" print statement to logger.debug() call MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I left the "THOMAS" part in for now, but this seems more like a debug message than a user facing message to me—but it was also obviously something @thomasvs left in for himself, so maybe the whole if clause has no reason to still be there and should just get removed. --- whipper/program/cdparanoia.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/whipper/program/cdparanoia.py b/whipper/program/cdparanoia.py index aa5e2f9..6fabefb 100644 --- a/whipper/program/cdparanoia.py +++ b/whipper/program/cdparanoia.py @@ -121,8 +121,9 @@ class ProgressParser: def _parse_read(self, wordOffset): if wordOffset % common.WORDS_PER_FRAME != 0: - print 'THOMAS: not a multiple of %d: %d' % ( - common.WORDS_PER_FRAME, wordOffset) + logger.debug( + 'THOMAS: not a multiple of %d: %d' % ( + common.WORDS_PER_FRAME, wordOffset)) return frameOffset = wordOffset / common.WORDS_PER_FRAME