make sources an object property
This commit is contained in:
@@ -142,6 +142,9 @@ class TocFile(object, log.Loggable):
|
|||||||
self.table = table.Table()
|
self.table = table.Table()
|
||||||
self.logName = '<TocFile %08x>' % id(self)
|
self.logName = '<TocFile %08x>' % id(self)
|
||||||
|
|
||||||
|
self._sources = Sources()
|
||||||
|
|
||||||
|
|
||||||
def parse(self):
|
def parse(self):
|
||||||
# these two objects start as None then get set as real objects,
|
# these two objects start as None then get set as real objects,
|
||||||
# so no need to complain about them here
|
# so no need to complain about them here
|
||||||
@@ -161,8 +164,6 @@ class TocFile(object, log.Loggable):
|
|||||||
totalLength = 0 # accrued during TRACK record parsing, total disc
|
totalLength = 0 # accrued during TRACK record parsing, total disc
|
||||||
pregapLength = 0 # length of the pre-gap, current track in for loop
|
pregapLength = 0 # length of the pre-gap, current track in for loop
|
||||||
|
|
||||||
sources = Sources()
|
|
||||||
|
|
||||||
# the first track's INDEX 1 can only be gotten from the .toc
|
# the first track's INDEX 1 can only be gotten from the .toc
|
||||||
# file once the first pregap is calculated; so we add INDEX 1
|
# file once the first pregap is calculated; so we add INDEX 1
|
||||||
# at the end of each parsed TRACK record
|
# at the end of each parsed TRACK record
|
||||||
@@ -248,7 +249,7 @@ class TocFile(object, log.Loggable):
|
|||||||
if m:
|
if m:
|
||||||
length = m.group('length')
|
length = m.group('length')
|
||||||
self.debug('SILENCE of %r', length)
|
self.debug('SILENCE of %r', length)
|
||||||
sources.append(counter, absoluteOffset, None)
|
self._sources.append(counter, absoluteOffset, None)
|
||||||
if currentFile is not None:
|
if currentFile is not None:
|
||||||
self.debug('SILENCE after FILE, increasing counter')
|
self.debug('SILENCE after FILE, increasing counter')
|
||||||
counter += 1
|
counter += 1
|
||||||
@@ -284,7 +285,7 @@ class TocFile(object, log.Loggable):
|
|||||||
trackNumber, counter)
|
trackNumber, counter)
|
||||||
currentFile = File(filePath, common.msfToFrames(start),
|
currentFile = File(filePath, common.msfToFrames(start),
|
||||||
common.msfToFrames(length))
|
common.msfToFrames(length))
|
||||||
sources.append(counter, absoluteOffset + currentLength,
|
self._sources.append(counter, absoluteOffset + currentLength,
|
||||||
currentFile)
|
currentFile)
|
||||||
#absoluteOffset += common.msfToFrames(start)
|
#absoluteOffset += common.msfToFrames(start)
|
||||||
currentLength += common.msfToFrames(length)
|
currentLength += common.msfToFrames(length)
|
||||||
@@ -318,10 +319,10 @@ class TocFile(object, log.Loggable):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
length = common.msfToFrames(m.group('length'))
|
length = common.msfToFrames(m.group('length'))
|
||||||
c, o, s = sources.get(absoluteOffset)
|
c, o, s = self._sources.get(absoluteOffset)
|
||||||
self.debug('at abs offset %d, we are in source %r' % (
|
self.debug('at abs offset %d, we are in source %r' % (
|
||||||
absoluteOffset, s))
|
absoluteOffset, s))
|
||||||
counterStart = sources.getCounterStart(c)
|
counterStart = self._sources.getCounterStart(c)
|
||||||
relativeOffset = absoluteOffset - counterStart
|
relativeOffset = absoluteOffset - counterStart
|
||||||
|
|
||||||
currentTrack.index(0, path=s and s.path or None,
|
currentTrack.index(0, path=s and s.path or None,
|
||||||
|
|||||||
Reference in New Issue
Block a user