[SCM] morituri/master: * morituri/image/cue.py: Use names for matches in regexps.
js at users.alioth.debian.org
js at users.alioth.debian.org
Sun Oct 19 20:08:47 UTC 2014
The following commit has been merged in the master branch:
commit 68b6db9e10faf488e68f9f959aefd8d7f2ee22e7
Author: Thomas Vander Stichele <thomas (at) apestaart (dot) org>
Date: Sun Apr 19 21:47:18 2009 +0000
* morituri/image/cue.py:
Use names for matches in regexps.
diff --git a/ChangeLog b/ChangeLog
index e6ffc18..01bb389 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2009-04-19 Thomas Vander Stichele <thomas at apestaart dot org>
+ * morituri/image/cue.py:
+ Use names for matches in regexps.
+
+2009-04-19 Thomas Vander Stichele <thomas at apestaart dot org>
+
* examples/readtoc.py (added):
Add an example to read the TOC, not finished yet.
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<name>.*)" # 'file name' in quotes
+ \s+(?P<format>\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<track>\d\d) # two-digit track number
+ \s+(?P<mode>\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)
--
morituri packaging
More information about the pkg-multimedia-commits
mailing list