summaryrefslogtreecommitdiffstats
path: root/Lib/plat-irix5
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/plat-irix5')
-rwxr-xr-xLib/plat-irix5/cddb.py11
-rwxr-xr-xLib/plat-irix5/cdplayer.py10
-rwxr-xr-xLib/plat-irix5/flp.py15
3 files changed, 17 insertions, 19 deletions
diff --git a/Lib/plat-irix5/cddb.py b/Lib/plat-irix5/cddb.py
index 57cf3c6..acd7870 100755
--- a/Lib/plat-irix5/cddb.py
+++ b/Lib/plat-irix5/cddb.py
@@ -81,18 +81,17 @@ class Cddb:
self.notes = []
if not hasattr(self, 'file'):
return
- import regex
- reg = regex.compile('^\\([^.]*\\)\\.\\([^:]*\\):[\t ]+\\(.*\\)')
+ import re
+ reg = re.compile(r'^([^.]*)\.([^:]*):[\t ]+(.*)')
while 1:
line = f.readline()
if not line:
break
- if reg.match(line) == -1:
+ match = reg.match(line)
+ if not match:
print 'syntax error in ' + file
continue
- name1 = line[reg.regs[1][0]:reg.regs[1][1]]
- name2 = line[reg.regs[2][0]:reg.regs[2][1]]
- value = line[reg.regs[3][0]:reg.regs[3][1]]
+ name1, name2, value = match.group(1, 2, 3)
if name1 == 'album':
if name2 == 'artist':
self.artist = value
diff --git a/Lib/plat-irix5/cdplayer.py b/Lib/plat-irix5/cdplayer.py
index 5c2c95a..0e27468 100755
--- a/Lib/plat-irix5/cdplayer.py
+++ b/Lib/plat-irix5/cdplayer.py
@@ -39,8 +39,8 @@ class Cdplayer:
f = open(posix.environ['HOME'] + '/' + cdplayerrc, 'r')
except IOError:
return
- import regex
- reg = regex.compile('^\\([^:]*\\):\t\\(.*\\)')
+ import re
+ reg = re.compile(r'^([^:]*):\t(.*)')
s = self.id + '.'
l = len(s)
while 1:
@@ -49,11 +49,11 @@ class Cdplayer:
break
if line[:l] == s:
line = line[l:]
- if reg.match(line) == -1:
+ match = reg.match(line)
+ if not match:
print 'syntax error in ~/' + cdplayerrc
continue
- name = line[reg.regs[1][0]:reg.regs[1][1]]
- value = line[reg.regs[2][0]:reg.regs[2][1]]
+ name, valye = match.group(1, 2)
if name == 'title':
self.title = value
elif name == 'artist':
diff --git a/Lib/plat-irix5/flp.py b/Lib/plat-irix5/flp.py
index 14e2278..a277f7f 100755
--- a/Lib/plat-irix5/flp.py
+++ b/Lib/plat-irix5/flp.py
@@ -267,19 +267,18 @@ _parse_func = { \
# This function parses a line, and returns either
# a string or a tuple (name,value)
-import regex
-prog = regex.compile('^\([^:]*\): *\(.*\)')
+import re
+prog = re.compile('^([^:]*): *(.*)')
def _parse_line(line):
- if prog.match(line) < 0:
+ match = prog.match(line)
+ if not match:
return line
- a = prog.regs
- name = line[:a[1][1]]
+ name, value = match.group(1, 2)
if name[0] == 'N':
- name = string.joinfields(string.split(name),'')
+ name = string.join(string.split(name),'')
name = string.lower(name)
- name = string.upper(name[0]) + name[1:]
- value = line[a[2][0]:]
+ name = string.capitalize(name)
try:
pf = _parse_func[name]
except KeyError: