Merge pull request #161 from Freso/minor-touchups

Minor touchups
This commit is contained in:
JoeLametta
2017-05-21 10:08:17 +02:00
committed by GitHub
11 changed files with 12 additions and 36 deletions

View File

@@ -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)
@@ -212,7 +211,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

View File

@@ -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
@@ -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.
"""

View File

@@ -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
@@ -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'))

View File

@@ -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):

View File

@@ -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)

View File

@@ -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

View File

@@ -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)
@@ -477,7 +473,7 @@ class Table(object):
pass
logger.debug('Musicbrainz values: %r', result)
logger.debug('MusicBrainz values: %r', result)
return result
def getAccurateRipIds(self):
@@ -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]

View File

@@ -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)

View File

@@ -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
@@ -144,8 +145,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

View File

@@ -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-")

View File

@@ -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
@@ -284,7 +276,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)
@@ -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()