PRE_EMPHASIS (#27)

* update README to force python2

* add support for PRE_EMPHASIS detection; mark pre-emphasis as FLAGS PRE in .cue

* correct typo, s/ivar/type/ for pre_emphasis element in track table
This commit is contained in:
Samantha Baldwin
2016-07-24 16:43:29 -04:00
committed by JoeLametta
parent 71422bd96b
commit b97e0a72e3
2 changed files with 24 additions and 9 deletions

View File

@@ -54,15 +54,17 @@ class Track:
"""
I represent a track entry in an Table.
@ivar number: track number (1-based)
@type number: int
@ivar audio: whether the track is audio
@type audio: bool
@type indexes: dict of number -> L{Index}
@ivar isrc: ISRC code (12 alphanumeric characters)
@type isrc: str
@ivar cdtext: dictionary of CD Text information; see L{CDTEXT_KEYS}.
@type cdtext: str -> unicode
@ivar number: track number (1-based)
@type number: int
@ivar audio: whether the track is audio
@type audio: bool
@type indexes: dict of number -> L{Index}
@ivar isrc: ISRC code (12 alphanumeric characters)
@type isrc: str
@ivar cdtext: dictionary of CD Text information; see L{CDTEXT_KEYS}.
@type cdtext: str -> unicode
@ivar pre_emphasis: whether track is pre-emphasised
@type pre_emphasis: bool
"""
number = None
@@ -71,6 +73,7 @@ class Track:
isrc = None
cdtext = None
session = None
pre_emphasis = None
def __repr__(self):
return '<Track %02d>' % self.number
@@ -618,6 +621,9 @@ class Table(object, log.Loggable):
if track.isrc is not None:
lines.append(" ISRC %s" % track.isrc)
if track.pre_emphasis is not None:
lines.append(" FLAGS PRE")
# handle TRACK 01 INDEX 00 specially
if 0 in indexes:
index00 = track.indexes[0]

View File

@@ -38,6 +38,9 @@ _CDTEXT_CANDIDATE_RE = re.compile(r'(?P<key>\w+) "(?P<value>.+)"')
# header
_CATALOG_RE = re.compile(r'^CATALOG "(?P<catalog>\d+)"$')
# pre emphasis
_PRE_EMPHASIS_RE = re.compile(r'^PRE_EMPHASIS$')
# records
_TRACK_RE = re.compile(r"""
^TRACK # TRACK
@@ -251,6 +254,12 @@ class TocFile(object, log.Loggable):
continue
# look for PRE_EMPHASIS lines
m = _PRE_EMPHASIS_RE.search(line)
if m:
currentTrack.pre_emphasis = True
self.debug('Track has PRE_EMPHASIS')
# look for ISRC lines
m = _ISRC_RE.search(line)
if m: