diff --git a/ChangeLog b/ChangeLog index e6ffc18..01bb389 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-04-19 Thomas Vander Stichele + + * morituri/image/cue.py: + Use names for matches in regexps. + 2009-04-19 Thomas Vander Stichele * examples/readtoc.py (added): diff --git a/morituri/image/cue.py b/morituri/image/cue.py index 2d0caef..3a99499 100644 --- a/morituri/image/cue.py +++ b/morituri/image/cue.py @@ -33,15 +33,15 @@ _PERFORMER_RE = re.compile("^PERFORMER\s(.*)$") _TITLE_RE = re.compile("^TITLE\s(.*)$") _FILE_RE = re.compile(r""" - ^FILE # FILE - \s+"(.*)" # 'file name' in quotes - \s+(\w+)$ # format (WAVE/MP3/AIFF/...) + ^FILE # FILE + \s+"(?P.*)" # 'file name' in quotes + \s+(?P\w+)$ # format (WAVE/MP3/AIFF/...) """, re.VERBOSE) _TRACK_RE = re.compile(r""" - ^\s+TRACK # TRACK - \s+(\d\d) # two-digit track number - \s+(\w+)$ # mode (AUDIO/...) + ^\s+TRACK # TRACK + \s+(?P\d\d) # two-digit track number + \s+(?P\w+)$ # mode (AUDIO/...) """, re.VERBOSE) _INDEX_RE = re.compile(r""" @@ -83,8 +83,8 @@ class Cue: # look for FILE lines m = _FILE_RE.search(line) if m: - filePath = m.expand('\\1') - fileFormat = m.expand('\\2') + filePath = m.group('name') + fileFormat = m.group('format') currentFile = File(filePath, fileFormat) # look for TRACK lines @@ -96,8 +96,8 @@ class Cue: state = 'TRACK' - trackNumber = int(m.expand('\\1')) - trackMode = m.expand('\\2') + trackNumber = int(m.group('track')) + trackMode = m.group('mode') currentTrack = Track(trackNumber) self.tracks.append(currentTrack)