diff options
author | Guido van Rossum <guido@python.org> | 1994-08-01 11:34:53 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1994-08-01 11:34:53 (GMT) |
commit | b6775db241f5fe5e3dc2ca09fc6c9e6164d4b2af (patch) | |
tree | 9362939305b2d088b8f19a530c9015d886bc2801 /Lib/irix5/cddb.py | |
parent | 2979b01ff88ac4c5b316d9bf98edbaaaffac8e24 (diff) | |
download | cpython-b6775db241f5fe5e3dc2ca09fc6c9e6164d4b2af.zip cpython-b6775db241f5fe5e3dc2ca09fc6c9e6164d4b2af.tar.gz cpython-b6775db241f5fe5e3dc2ca09fc6c9e6164d4b2af.tar.bz2 |
Merge alpha100 branch back to main trunk
Diffstat (limited to 'Lib/irix5/cddb.py')
-rwxr-xr-x | Lib/irix5/cddb.py | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/Lib/irix5/cddb.py b/Lib/irix5/cddb.py index d7fdc96..0dee709 100755 --- a/Lib/irix5/cddb.py +++ b/Lib/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() |