Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/gutextract.py
diff options
context:
space:
mode:
authorJames Simmons <jim@olpc.simmons>2009-05-30 17:21:37 (GMT)
committer James Simmons <jim@olpc.simmons>2009-05-30 17:21:37 (GMT)
commitdda7cc77995b8a74b90589101456e32093308d2d (patch)
tree30368e225d377ddb18d3f1f3d7ea1062e82ee13d /gutextract.py
parent3819df4bed8588931863d67520a25dcd676db137 (diff)
modified: gutextract.py
Handle title/author split better
Diffstat (limited to 'gutextract.py')
-rwxr-xr-xgutextract.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/gutextract.py b/gutextract.py
index d2dc691..7346377 100755
--- a/gutextract.py
+++ b/gutextract.py
@@ -49,7 +49,11 @@ def main(file_path):
if line.find(', by ') > -1:
line = line.replace(', by ', '|')
else:
- line = line + '| '
+ comma_pos = line.rfind(',')
+ if comma_pos > -1:
+ line = line[0:comma_pos] + '|' + line[comma_pos+1:len(line)].lstrip()
+ else:
+ line = line + '| '
out.write(line + '|' + path + '\n')
elif line[77].isdigit() and line.find("Audio:") < 0 and line[59] == '[':
path = '/etext' + line[6:8] + '/' + line[60:65]
@@ -59,7 +63,12 @@ def main(file_path):
if line.find(', by ') > -1:
line = line.replace(', by ', '|')
else:
- line = line + '| '
+ comma_pos = line.rfind(',')
+ if comma_pos > -1:
+ line = line[0:comma_pos] + '|' + line[comma_pos+1:len(line)].lstrip()
+ print line
+ else:
+ line = line + '| '
out.write(line + '|' + path + '\n')
gut_file.close()
out.close()