Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor touchups #161

Merged
merged 4 commits into from
May 21, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions whipper/command/cd.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ def do(self):
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)

Expand Down Expand Up @@ -212,7 +211,7 @@ def doCommand(self):

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

Expand Down
4 changes: 2 additions & 2 deletions whipper/common/mbngs.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
# along with whipper. If not, see <http://www.gnu.org/licenses/>.

"""
Handles communication with the musicbrainz server using NGS.
Handles communication with the MusicBrainz server using NGS.
"""

import urllib2
Expand Down Expand Up @@ -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.
"""

Expand Down
6 changes: 3 additions & 3 deletions whipper/common/program.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def getTable(self, runner, cddbdiscid, mbdiscid, device, offset):
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

Expand Down Expand Up @@ -286,7 +286,7 @@ def getMusicBrainz(self, ittoc, mbdiscid, release=None, country=None, prompt=Fal
"""
@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()))
Expand Down Expand Up @@ -395,7 +395,7 @@ def getMusicBrainz(self, ittoc, mbdiscid, release=None, country=None, prompt=Fal
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'))
Expand Down
1 change: 0 additions & 1 deletion whipper/extern/task/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,6 @@ def _output(self, what, newline=False, ret=True):
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):
Expand Down
1 change: 0 additions & 1 deletion whipper/image/cue.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ def parse(self):
state = 'TRACK'

trackNumber = int(m.group('track'))
#trackMode = m.group('mode')

logger.debug('found track %d', trackNumber)
currentTrack = table.Track(trackNumber)
Expand Down
1 change: 0 additions & 1 deletion whipper/image/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,6 @@ def stop(self):
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
Expand Down
7 changes: 1 addition & 6 deletions whipper/image/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,6 @@ def getCDDBValues(self):
# 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:
Expand All @@ -293,7 +291,6 @@ def getCDDBValues(self):
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)
Expand Down Expand Up @@ -369,7 +366,6 @@ def getMusicBrainzDiscId(self):
try:
offset = values[2 + i]
except IndexError:
#print 'track', i - 1, '0 offset'
offset = 0
sha.update("%08X" % offset)

Expand Down Expand Up @@ -477,7 +473,7 @@ def _getMusicBrainzValues(self):
pass


logger.debug('Musicbrainz values: %r', result)
logger.debug('MusicBrainz values: %r', result)
return result

def getAccurateRipIds(self):
Expand Down Expand Up @@ -727,7 +723,6 @@ def absolutize(self):
# 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]
Expand Down
3 changes: 0 additions & 3 deletions whipper/image/toc.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,15 +311,13 @@ def parse(self):
common.msfToFrames(length))
self._sources.append(counter, absoluteOffset + currentLength,
currentFile)
#absoluteOffset += common.msfToFrames(start)
currentLength += common.msfToFrames(length)

# look for DATAFILE lines
m = _DATAFILE_RE.search(line)
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:
Expand All @@ -332,7 +330,6 @@ def parse(self):
currentFile = File(filePath, 0, common.msfToFrames(length))
self._sources.append(counter, absoluteOffset + currentLength,
currentFile)
#absoluteOffset += common.msfToFrames(start)
currentLength += common.msfToFrames(length)


Expand Down
7 changes: 3 additions & 4 deletions whipper/program/cdparanoia.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,9 @@ def parse(self, line):

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
Expand All @@ -144,8 +145,6 @@ def _parse_read(self, wordOffset):
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

Expand Down
2 changes: 1 addition & 1 deletion whipper/test/test_image_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def testMusicBrainz(self):
# 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-")
Expand Down
13 changes: 1 addition & 12 deletions whipper/test/test_image_toc.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ def testSetFile(self):
self._assertAbsolute(2, 1, 28324)
self._assertPath(1, 1, "data.wav")

# self.toc.table.absolutize()
self.toc.table.clearFiles()

self._assertAbsolute(1, 1, 0)
Expand All @@ -86,7 +85,6 @@ def testSetFile(self):
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)
Expand Down Expand Up @@ -155,14 +153,12 @@ def testIndexes(self):
# 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
Expand All @@ -171,7 +167,6 @@ def testCDDBId(self):

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')
Expand Down Expand Up @@ -216,11 +211,9 @@ def setUp(self):
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
Expand Down Expand Up @@ -269,7 +262,6 @@ def setUp(self):
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
Expand All @@ -284,7 +276,7 @@ def testMusicBrainz(self):

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)
Expand Down Expand Up @@ -336,7 +328,6 @@ def setUp(self):
self.assertEquals(len(self.toc.table.tracks), 11)

def testCDDBId(self):
#self.toc.table.absolutize()
self.assertEquals(self.toc.table.getCDDBDiscId(), '810b7b0b')


Expand Down Expand Up @@ -440,5 +431,3 @@ def testIndexes(self):
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()