summaryrefslogtreecommitdiffstats
path: root/Lib/plat-irix5/cddb.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1994-08-01 11:34:53 (GMT)
committerGuido van Rossum <guido@python.org>1994-08-01 11:34:53 (GMT)
commitb6775db241f5fe5e3dc2ca09fc6c9e6164d4b2af (patch)
tree9362939305b2d088b8f19a530c9015d886bc2801 /Lib/plat-irix5/cddb.py
parent2979b01ff88ac4c5b316d9bf98edbaaaffac8e24 (diff)
downloadcpython-b6775db241f5fe5e3dc2ca09fc6c9e6164d4b2af.zip
cpython-b6775db241f5fe5e3dc2ca09fc6c9e6164d4b2af.tar.gz
cpython-b6775db241f5fe5e3dc2ca09fc6c9e6164d4b2af.tar.bz2
Merge alpha100 branch back to main trunk
Diffstat (limited to 'Lib/plat-irix5/cddb.py')
-rwxr-xr-xLib/plat-irix5/cddb.py26
1 files changed, 25 insertions, 1 deletions
diff --git a/Lib/plat-irix5/cddb.py b/Lib/plat-irix5/cddb.py
index d7fdc96..0dee709 100755
--- a/Lib/plat-irix5/cddb.py
+++ b/Lib/plat-irix5/cddb.py
@@ -138,6 +138,19 @@ class Cddb:
continue
self.track[trackno] = value
f.close()
+ for i in range(2, len(self.track)):
+ track = self.track[i]
+ # if track title starts with `,', use initial part
+ # of previous track's title
+ if track[0] == ',':
+ try:
+ off = string.index(self.track[i - 1],
+ ',')
+ except string.index_error:
+ pass
+ else:
+ self.track[i] = self.track[i-1][:off] \
+ + track
def write(self):
import posixpath
@@ -153,6 +166,17 @@ class Cddb:
f.write('album.title:\t' + self.title + '\n')
f.write('album.artist:\t' + self.artist + '\n')
f.write('album.toc:\t' + self.toc + '\n')
+ prevpref = None
for i in range(1, len(self.track)):
- f.write('track' + `i` + '.title:\t' + self.track[i] + '\n')
+ track = self.track[i]
+ try:
+ off = string.index(track, ',')
+ except string.index_error:
+ prevpref = None
+ else:
+ if prevpref and track[:off] == prevpref:
+ track = track[off:]
+ else:
+ prevpref = track[:off]
+ f.write('track' + `i` + '.title:\t' + track + '\n')
f.close()