-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathFTWVoiceLineParser.py
61 lines (54 loc) · 2.67 KB
/
FTWVoiceLineParser.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#Fare Thee Well Voice Parser 1.0.1
print('Please enter the file to be parsed. Include the file path.')
inputFilePath = input()
inputFileName = inputFilePath.rsplit('\\', 1)[1]
filePath = inputFilePath.rsplit('\\', 1)[0]
outputFileName = '\\parsed_' + inputFileName
outputFilePath = filePath + outputFileName
print('Please enter the scene\'s route tag.')
routeTag = input()
print('Please enter the scene number.')
sceneNumber = input()
lineCount = 1
with open(inputFilePath, 'r') as infile, open(outputFilePath, 'w') as outfile:
for line in infile:
if ' wan' in line[:7]:
outfile.write(' voice "' + routeTag + '-' + sceneNumber + '-' + str(lineCount) + '.mp3" #Wayfarer (Terrance Drye)\n')
outfile.write(line)
lineCount += 1
elif ' ten' in line[:7]:
outfile.write(' voice "' + routeTag + '-' + sceneNumber + '-' + str(lineCount) + '.mp3" #Bartender (Andrew Boa)\n')
outfile.write(line)
lineCount += 1
elif ' gir' in line[:7]:
outfile.write(' voice "' + routeTag + '-' + sceneNumber + '-' + str(lineCount) + '.mp3" #Emmeline (Hayley Nelson)\n')
outfile.write(line)
lineCount += 1
elif ' emm' in line[:7]:
outfile.write(' voice "' + routeTag + '-' + sceneNumber + '-' + str(lineCount) + '.mp3" #Emmeline (Hayley Nelson)\n')
outfile.write(line)
lineCount += 1
elif ' tru' in line[:7]:
outfile.write(' voice "' + routeTag + '-' + sceneNumber + '-' + str(lineCount) + '.mp3" #Trucker (Sean Wisner)\n')
outfile.write(line)
lineCount += 1
elif ' can' in line[:7]:
outfile.write(' voice "' + routeTag + '-' + sceneNumber + '-' + str(lineCount) + '.mp3" #Candace (Victoria Wong)\n')
outfile.write(line)
lineCount += 1
elif ' ros' in line[:7]:
outfile.write(' voice "' + routeTag + '-' + sceneNumber + '-' + str(lineCount) + '.mp3" #Rosa (Tiana Camacho)\n')
outfile.write(line)
lineCount += 1
elif ' mic' in line[:7]:
outfile.write(' voice "' + routeTag + '-' + sceneNumber + '-' + str(lineCount) + '.mp3" #Michael (Reece Bridger)\n')
outfile.write(line)
lineCount += 1
elif ' ymic' in line[:8]:
outfile.write(' voice "' + routeTag + '-' + sceneNumber + '-' + str(lineCount) + '.mp3" #Young Michael (Dani Chambers)\n')
outfile.write(line)
lineCount += 1
else:
outfile.write(line)
print('Scene has been successfully parsed! Output location: ')
print(outputFilePath)