@@ -102,7 +102,6 @@ class _CD(BaseCommand):
|
|||||||
self.runner = task.SyncRunner()
|
self.runner = task.SyncRunner()
|
||||||
|
|
||||||
# if the device is mounted (data session), unmount it
|
# if the device is mounted (data session), unmount it
|
||||||
#self.device = self.parentCommand.options.device
|
|
||||||
self.device = self.options.device
|
self.device = self.options.device
|
||||||
sys.stdout.write('Checking device %s\n' % self.device)
|
sys.stdout.write('Checking device %s\n' % self.device)
|
||||||
|
|
||||||
@@ -212,7 +211,7 @@ class _CD(BaseCommand):
|
|||||||
|
|
||||||
class Info(_CD):
|
class Info(_CD):
|
||||||
summary = "retrieve information about the currently inserted 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.")
|
"information for the currently inserted CD.")
|
||||||
eject = False
|
eject = False
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
# along with whipper. If not, see <http://www.gnu.org/licenses/>.
|
# 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
|
import urllib2
|
||||||
@@ -113,7 +113,7 @@ def _record(record, which, name, what):
|
|||||||
|
|
||||||
class _Credit(list):
|
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.
|
or track.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ class Program:
|
|||||||
itable = None
|
itable = None
|
||||||
tdict = {}
|
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:
|
if type(ptable.object) is dict:
|
||||||
tdict = ptable.object
|
tdict = ptable.object
|
||||||
|
|
||||||
@@ -286,7 +286,7 @@ class Program:
|
|||||||
"""
|
"""
|
||||||
@type ittoc: L{whipper.image.table.Table}
|
@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' % (
|
self._stdout.write('Disc duration: %s, %d audio tracks\n' % (
|
||||||
common.formatTime(ittoc.duration() / 1000.0),
|
common.formatTime(ittoc.duration() / 1000.0),
|
||||||
ittoc.getAudioTracks()))
|
ittoc.getAudioTracks()))
|
||||||
@@ -395,7 +395,7 @@ class Program:
|
|||||||
if (not release and len(deltas.keys()) > 1):
|
if (not release and len(deltas.keys()) > 1):
|
||||||
self._stdout.write('\n')
|
self._stdout.write('\n')
|
||||||
self._stdout.write('Picked closest match in duration.\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')
|
'please correct.\n')
|
||||||
self._stdout.write('Artist : %s\n' %
|
self._stdout.write('Artist : %s\n' %
|
||||||
artist.encode('utf-8'))
|
artist.encode('utf-8'))
|
||||||
|
|||||||
1
whipper/extern/task/task.py
vendored
1
whipper/extern/task/task.py
vendored
@@ -543,7 +543,6 @@ class SyncRunner(TaskRunner, ITaskListener):
|
|||||||
sys.stdout.write('\n')
|
sys.stdout.write('\n')
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
if len(what) > self._longest:
|
if len(what) > self._longest:
|
||||||
#print; print 'setting longest', self._longest; print
|
|
||||||
self._longest = len(what)
|
self._longest = len(what)
|
||||||
|
|
||||||
def described(self, task, description):
|
def described(self, task, description):
|
||||||
|
|||||||
@@ -119,7 +119,6 @@ class CueFile(object):
|
|||||||
state = 'TRACK'
|
state = 'TRACK'
|
||||||
|
|
||||||
trackNumber = int(m.group('track'))
|
trackNumber = int(m.group('track'))
|
||||||
#trackMode = m.group('mode')
|
|
||||||
|
|
||||||
logger.debug('found track %d', trackNumber)
|
logger.debug('found track %d', trackNumber)
|
||||||
currentTrack = table.Track(trackNumber)
|
currentTrack = table.Track(trackNumber)
|
||||||
|
|||||||
@@ -203,7 +203,6 @@ class ImageVerifyTask(task.MultiSeparateTask):
|
|||||||
if taskk.length is None:
|
if taskk.length is None:
|
||||||
raise ValueError("Track length was not found; look for "
|
raise ValueError("Track length was not found; look for "
|
||||||
"earlier errors in debug log (set RIP_DEBUG=4)")
|
"earlier errors in debug log (set RIP_DEBUG=4)")
|
||||||
# print '%d has length %d' % (trackIndex, taskk.length)
|
|
||||||
index = track.indexes[1]
|
index = track.indexes[1]
|
||||||
assert taskk.length % common.SAMPLES_PER_FRAME == 0
|
assert taskk.length % common.SAMPLES_PER_FRAME == 0
|
||||||
end = taskk.length / common.SAMPLES_PER_FRAME
|
end = taskk.length / common.SAMPLES_PER_FRAME
|
||||||
|
|||||||
@@ -281,8 +281,6 @@ class Table(object):
|
|||||||
# CD's have a standard lead-in time of 2 seconds
|
# CD's have a standard lead-in time of 2 seconds
|
||||||
# which gets added for CDDB disc id's
|
# which gets added for CDDB disc id's
|
||||||
delta = 2 * common.FRAMES_PER_SECOND
|
delta = 2 * common.FRAMES_PER_SECOND
|
||||||
#if self.getTrackStart(1) > 0:
|
|
||||||
# delta = 0
|
|
||||||
|
|
||||||
debug = [str(len(self.tracks))]
|
debug = [str(len(self.tracks))]
|
||||||
for track in self.tracks:
|
for track in self.tracks:
|
||||||
@@ -293,7 +291,6 @@ class Table(object):
|
|||||||
n += self._cddbSum(seconds)
|
n += self._cddbSum(seconds)
|
||||||
|
|
||||||
# the 'real' leadout, not offset by 150 frames
|
# the 'real' leadout, not offset by 150 frames
|
||||||
# print 'THOMAS: disc leadout', self.leadout
|
|
||||||
last = self.tracks[-1]
|
last = self.tracks[-1]
|
||||||
leadout = self.getTrackEnd(last.number) + 1
|
leadout = self.getTrackEnd(last.number) + 1
|
||||||
logger.debug('leadout LBA: %d', leadout)
|
logger.debug('leadout LBA: %d', leadout)
|
||||||
@@ -369,7 +366,6 @@ class Table(object):
|
|||||||
try:
|
try:
|
||||||
offset = values[2 + i]
|
offset = values[2 + i]
|
||||||
except IndexError:
|
except IndexError:
|
||||||
#print 'track', i - 1, '0 offset'
|
|
||||||
offset = 0
|
offset = 0
|
||||||
sha.update("%08X" % offset)
|
sha.update("%08X" % offset)
|
||||||
|
|
||||||
@@ -477,7 +473,7 @@ class Table(object):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
logger.debug('Musicbrainz values: %r', result)
|
logger.debug('MusicBrainz values: %r', result)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def getAccurateRipIds(self):
|
def getAccurateRipIds(self):
|
||||||
@@ -727,7 +723,6 @@ class Table(object):
|
|||||||
# the first cut is the deepest
|
# the first cut is the deepest
|
||||||
counter = index.counter
|
counter = index.counter
|
||||||
|
|
||||||
#for t in self.tracks: print t, t.indexes
|
|
||||||
logger.debug('absolutizing')
|
logger.debug('absolutizing')
|
||||||
while True:
|
while True:
|
||||||
track = self.tracks[t - 1]
|
track = self.tracks[t - 1]
|
||||||
|
|||||||
@@ -311,7 +311,6 @@ class TocFile(object):
|
|||||||
common.msfToFrames(length))
|
common.msfToFrames(length))
|
||||||
self._sources.append(counter, absoluteOffset + currentLength,
|
self._sources.append(counter, absoluteOffset + currentLength,
|
||||||
currentFile)
|
currentFile)
|
||||||
#absoluteOffset += common.msfToFrames(start)
|
|
||||||
currentLength += common.msfToFrames(length)
|
currentLength += common.msfToFrames(length)
|
||||||
|
|
||||||
# look for DATAFILE lines
|
# look for DATAFILE lines
|
||||||
@@ -319,7 +318,6 @@ class TocFile(object):
|
|||||||
if m:
|
if m:
|
||||||
filePath = m.group('name')
|
filePath = m.group('name')
|
||||||
length = m.group('length')
|
length = m.group('length')
|
||||||
# print 'THOMAS', length
|
|
||||||
logger.debug('FILE %s, length %r',
|
logger.debug('FILE %s, length %r',
|
||||||
filePath, common.msfToFrames(length))
|
filePath, common.msfToFrames(length))
|
||||||
if not currentFile or filePath != currentFile.path:
|
if not currentFile or filePath != currentFile.path:
|
||||||
@@ -332,7 +330,6 @@ class TocFile(object):
|
|||||||
currentFile = File(filePath, 0, common.msfToFrames(length))
|
currentFile = File(filePath, 0, common.msfToFrames(length))
|
||||||
self._sources.append(counter, absoluteOffset + currentLength,
|
self._sources.append(counter, absoluteOffset + currentLength,
|
||||||
currentFile)
|
currentFile)
|
||||||
#absoluteOffset += common.msfToFrames(start)
|
|
||||||
currentLength += common.msfToFrames(length)
|
currentLength += common.msfToFrames(length)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -121,8 +121,9 @@ class ProgressParser:
|
|||||||
|
|
||||||
def _parse_read(self, wordOffset):
|
def _parse_read(self, wordOffset):
|
||||||
if wordOffset % common.WORDS_PER_FRAME != 0:
|
if wordOffset % common.WORDS_PER_FRAME != 0:
|
||||||
print 'THOMAS: not a multiple of %d: %d' % (
|
logger.debug(
|
||||||
common.WORDS_PER_FRAME, wordOffset)
|
'THOMAS: not a multiple of %d: %d' % (
|
||||||
|
common.WORDS_PER_FRAME, wordOffset))
|
||||||
return
|
return
|
||||||
|
|
||||||
frameOffset = wordOffset / common.WORDS_PER_FRAME
|
frameOffset = wordOffset / common.WORDS_PER_FRAME
|
||||||
@@ -144,8 +145,6 @@ class ProgressParser:
|
|||||||
if frameOffset > self.read:
|
if frameOffset > self.read:
|
||||||
delta = frameOffset - self.read
|
delta = frameOffset - self.read
|
||||||
if self._nframes and delta != self._nframes:
|
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
|
# my drive either reads 7 or 13 frames
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ class LadyhawkeTestCase(tcommon.TestCase):
|
|||||||
# https://musicbrainz.org/cdtoc/attach?toc=1+12+195856+150+
|
# https://musicbrainz.org/cdtoc/attach?toc=1+12+195856+150+
|
||||||
# 15687+31841+51016+66616+81352+99559+116070+133243+149997+161710+
|
# 15687+31841+51016+66616+81352+99559+116070+133243+149997+161710+
|
||||||
# 177832&tracks=12&id=KnpGsLhvH.lPrNc1PBL21lb9Bg4-
|
# 177832&tracks=12&id=KnpGsLhvH.lPrNc1PBL21lb9Bg4-
|
||||||
# however, not (yet) in musicbrainz database
|
# however, not (yet) in MusicBrainz database
|
||||||
|
|
||||||
self.assertEquals(self.table.getMusicBrainzDiscId(),
|
self.assertEquals(self.table.getMusicBrainzDiscId(),
|
||||||
"KnpGsLhvH.lPrNc1PBL21lb9Bg4-")
|
"KnpGsLhvH.lPrNc1PBL21lb9Bg4-")
|
||||||
|
|||||||
@@ -62,7 +62,6 @@ class CureTestCase(common.TestCase):
|
|||||||
self._assertAbsolute(2, 1, 28324)
|
self._assertAbsolute(2, 1, 28324)
|
||||||
self._assertPath(1, 1, "data.wav")
|
self._assertPath(1, 1, "data.wav")
|
||||||
|
|
||||||
# self.toc.table.absolutize()
|
|
||||||
self.toc.table.clearFiles()
|
self.toc.table.clearFiles()
|
||||||
|
|
||||||
self._assertAbsolute(1, 1, 0)
|
self._assertAbsolute(1, 1, 0)
|
||||||
@@ -86,7 +85,6 @@ class CureTestCase(common.TestCase):
|
|||||||
self._assertRelative(2, 1, None)
|
self._assertRelative(2, 1, None)
|
||||||
|
|
||||||
def testConvertCue(self):
|
def testConvertCue(self):
|
||||||
# self.toc.table.absolutize()
|
|
||||||
cue = self.toc.table.cue()
|
cue = self.toc.table.cue()
|
||||||
ref = self.readCue('cure.cue')
|
ref = self.readCue('cure.cue')
|
||||||
common.diffStrings(ref, 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
|
# This disc has a pre-gap, so is a good test for .CUE writing
|
||||||
|
|
||||||
def testConvertCue(self):
|
def testConvertCue(self):
|
||||||
#self.toc.table.absolutize()
|
|
||||||
self.failUnless(self.toc.table.hasTOC())
|
self.failUnless(self.toc.table.hasTOC())
|
||||||
cue = self.toc.table.cue()
|
cue = self.toc.table.cue()
|
||||||
ref = self.readCue('bloc.cue')
|
ref = self.readCue('bloc.cue')
|
||||||
common.diffStrings(ref, cue)
|
common.diffStrings(ref, cue)
|
||||||
|
|
||||||
def testCDDBId(self):
|
def testCDDBId(self):
|
||||||
# self.toc.table.absolutize()
|
|
||||||
# cd-discid output:
|
# cd-discid output:
|
||||||
# ad0be00d 13 15370 35019 51532 69190 84292 96826 112527 132448
|
# ad0be00d 13 15370 35019 51532 69190 84292 96826 112527 132448
|
||||||
# 148595 168072 185539 203331 222103 3244
|
# 148595 168072 185539 203331 222103 3244
|
||||||
@@ -171,7 +167,6 @@ class BlocTestCase(common.TestCase):
|
|||||||
|
|
||||||
def testAccurateRip(self):
|
def testAccurateRip(self):
|
||||||
# we verify it because it has failed in readdisc in the past
|
# we verify it because it has failed in readdisc in the past
|
||||||
# self.toc.table.absolutize()
|
|
||||||
self.assertEquals(self.toc.table.getAccurateRipURL(),
|
self.assertEquals(self.toc.table.getAccurateRipURL(),
|
||||||
'http://www.accuraterip.com/accuraterip/'
|
'http://www.accuraterip.com/accuraterip/'
|
||||||
'e/d/2/dBAR-013-001af2de-0105994e-ad0be00d.bin')
|
'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 = toc.TocFile(self.path)
|
||||||
self.toc.parse()
|
self.toc.parse()
|
||||||
self.assertEquals(len(self.toc.table.tracks), 13)
|
self.assertEquals(len(self.toc.table.tracks), 13)
|
||||||
#import code; code.interact(local=locals())
|
|
||||||
self.failIf(self.toc.table.tracks[-1].audio)
|
self.failIf(self.toc.table.tracks[-1].audio)
|
||||||
|
|
||||||
def testCDDBId(self):
|
def testCDDBId(self):
|
||||||
#self.toc.table.absolutize()
|
|
||||||
self.assertEquals(self.toc.table.getCDDBDiscId(), 'c60af50d')
|
self.assertEquals(self.toc.table.getCDDBDiscId(), 'c60af50d')
|
||||||
# output from cd-discid:
|
# output from cd-discid:
|
||||||
# c60af50d 13 150 15687 31841 51016 66616 81352 99559 116070 133243
|
# 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)
|
self.table.merge(self.toc2.table)
|
||||||
|
|
||||||
def testCDDBId(self):
|
def testCDDBId(self):
|
||||||
#self.table.absolutize()
|
|
||||||
self.assertEquals(self.table.getCDDBDiscId(), 'b910140c')
|
self.assertEquals(self.table.getCDDBDiscId(), 'b910140c')
|
||||||
# output from cd-discid:
|
# output from cd-discid:
|
||||||
# b910140c 12 24320 44855 64090 77885 88095 104020 118245 129255 141765
|
# b910140c 12 24320 44855 64090 77885 88095 104020 118245 129255 141765
|
||||||
@@ -284,7 +276,7 @@ class CapitalMergeTestCase(common.TestCase):
|
|||||||
|
|
||||||
def testDuration(self):
|
def testDuration(self):
|
||||||
# this matches track 11 end sector - track 1 start sector on
|
# this matches track 11 end sector - track 1 start sector on
|
||||||
# musicbrainz
|
# MusicBrainz
|
||||||
# compare to 3rd and 4th value in URL above
|
# compare to 3rd and 4th value in URL above
|
||||||
self.assertEquals(self.table.getFrameLength(), 173530)
|
self.assertEquals(self.table.getFrameLength(), 173530)
|
||||||
self.assertEquals(self.table.duration(), 2313733)
|
self.assertEquals(self.table.duration(), 2313733)
|
||||||
@@ -336,7 +328,6 @@ class TOTBLTestCase(common.TestCase):
|
|||||||
self.assertEquals(len(self.toc.table.tracks), 11)
|
self.assertEquals(len(self.toc.table.tracks), 11)
|
||||||
|
|
||||||
def testCDDBId(self):
|
def testCDDBId(self):
|
||||||
#self.toc.table.absolutize()
|
|
||||||
self.assertEquals(self.toc.table.getCDDBDiscId(), '810b7b0b')
|
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(1).absolute, 111257)
|
||||||
self.assertEquals(t.getIndex(2).relative, 111225 + 3370)
|
self.assertEquals(t.getIndex(2).relative, 111225 + 3370)
|
||||||
self.assertEquals(t.getIndex(2).absolute, 111257 + 3370)
|
self.assertEquals(t.getIndex(2).absolute, 111257 + 3370)
|
||||||
|
|
||||||
# print self.toc.table.cue()
|
|
||||||
|
|||||||
Reference in New Issue
Block a user