Skip to content

Commit

Permalink
feat: add more surface phrases (#114)
Browse files Browse the repository at this point in the history
  • Loading branch information
pfeerick authored May 30, 2024
1 parent c7d8fb7 commit 3769c75
Show file tree
Hide file tree
Showing 52 changed files with 76 additions and 9 deletions.
Binary file added SOUNDS/en/drifof.wav
Binary file not shown.
Binary file added SOUNDS/en/drifon.wav
Binary file not shown.
Binary file added SOUNDS/en/gyroof.wav
Binary file not shown.
Binary file added SOUNDS/en/gyroon.wav
Binary file not shown.
Binary file added SOUNDS/en/launch.wav
Binary file not shown.
Binary file added SOUNDS/en/maxast.wav
Binary file not shown.
Binary file added SOUNDS/en/maxgyr.wav
Binary file not shown.
Binary file added SOUNDS/en/wetmde.wav
Binary file not shown.
Binary file added SOUNDS/en_gb-libby/drifof.wav
Binary file not shown.
Binary file added SOUNDS/en_gb-libby/drifon.wav
Binary file not shown.
Binary file added SOUNDS/en_gb-libby/gyroof.wav
Binary file not shown.
Binary file added SOUNDS/en_gb-libby/gyroon.wav
Binary file not shown.
Binary file added SOUNDS/en_gb-libby/launch.wav
Binary file not shown.
Binary file added SOUNDS/en_gb-libby/maxast.wav
Binary file not shown.
Binary file added SOUNDS/en_gb-libby/maxgyr.wav
Binary file not shown.
Binary file added SOUNDS/en_gb-libby/wetmde.wav
Binary file not shown.
Binary file added SOUNDS/en_gb-ryan/drifof.wav
Binary file not shown.
Binary file added SOUNDS/en_gb-ryan/drifon.wav
Binary file not shown.
Binary file added SOUNDS/en_gb-ryan/gyroof.wav
Binary file not shown.
Binary file added SOUNDS/en_gb-ryan/gyroon.wav
Binary file not shown.
Binary file added SOUNDS/en_gb-ryan/launch.wav
Binary file not shown.
Binary file added SOUNDS/en_gb-ryan/maxast.wav
Binary file not shown.
Binary file added SOUNDS/en_gb-ryan/maxgyr.wav
Binary file not shown.
Binary file added SOUNDS/en_gb-ryan/wetmde.wav
Binary file not shown.
Binary file added SOUNDS/en_us-guy/drifof.wav
Binary file not shown.
Binary file added SOUNDS/en_us-guy/drifon.wav
Binary file not shown.
Binary file added SOUNDS/en_us-guy/gyroof.wav
Binary file not shown.
Binary file added SOUNDS/en_us-guy/gyroon.wav
Binary file not shown.
Binary file added SOUNDS/en_us-guy/launch.wav
Binary file not shown.
Binary file added SOUNDS/en_us-guy/maxast.wav
Binary file not shown.
Binary file added SOUNDS/en_us-guy/maxgyr.wav
Binary file not shown.
Binary file added SOUNDS/en_us-guy/wetmde.wav
Binary file not shown.
Binary file added SOUNDS/en_us-michelle/drifof.wav
Binary file not shown.
Binary file added SOUNDS/en_us-michelle/drifon.wav
Binary file not shown.
Binary file added SOUNDS/en_us-michelle/gyroof.wav
Binary file not shown.
Binary file added SOUNDS/en_us-michelle/gyroon.wav
Binary file not shown.
Binary file added SOUNDS/en_us-michelle/launch.wav
Binary file not shown.
Binary file added SOUNDS/en_us-michelle/maxast.wav
Binary file not shown.
Binary file added SOUNDS/en_us-michelle/maxgyr.wav
Binary file not shown.
Binary file added SOUNDS/en_us-michelle/wetmde.wav
Binary file not shown.
Binary file added SOUNDS/en_us-sara/drifof.wav
Binary file not shown.
Binary file added SOUNDS/en_us-sara/drifon.wav
Binary file not shown.
Binary file added SOUNDS/en_us-sara/gyroof.wav
Binary file not shown.
Binary file added SOUNDS/en_us-sara/gyroon.wav
Binary file not shown.
Binary file added SOUNDS/en_us-sara/launch.wav
Binary file not shown.
Binary file added SOUNDS/en_us-sara/maxast.wav
Binary file not shown.
Binary file added SOUNDS/en_us-sara/maxgyr.wav
Binary file not shown.
Binary file added SOUNDS/en_us-sara/wetmde.wav
Binary file not shown.
63 changes: 57 additions & 6 deletions build-checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import os
import sys

csv_directory = 'voices'
sound_directory = 'SOUNDS'
csv_directory = "voices"
sound_directory = "SOUNDS"

# TODO: Check for duplicate filenames in CSV files
# TODO: Check for files in SOUNDS that are not in CSV files
Expand All @@ -17,7 +17,7 @@ def checkCSVcolumnCount():
missing_csv_field = False
for filename in os.listdir(csv_directory):
f = os.path.join(csv_directory, filename)
if os.path.isfile(f) and filename.endswith('.csv'):
if os.path.isfile(f) and filename.endswith(".csv"):
reader = csv.reader(open(f, "r"))
for row in reader:
if not len(row) == 6:
Expand All @@ -31,6 +31,38 @@ def checkCSVcolumnCount():
return 0


def checkFilenameLengthsInCSV():
print("VOICES: Checking filename lengths in CSV files ...")
invalid_filename_found = False
for filename in os.listdir(csv_directory):
if filename.endswith("_scripts.csv"):
continue
f = os.path.join(csv_directory, filename)
if os.path.isfile(f) and filename.endswith(".csv"):
reader = csv.reader(open(f, "r"))
next(reader) # Skip the header row
for row in reader:
if len(row) == 6:
filename_in_csv = row[5]
path_in_csv = row[4]
if (
path_in_csv == "SYSTEM"
and len(os.path.splitext(filename_in_csv)[0]) > 8
):
print(f"{filename}: Filename too long - {filename_in_csv}")
invalid_filename_found = True
elif (
path_in_csv != "SYSTEM"
and len(os.path.splitext(filename_in_csv)[0]) > 6
):
print(f"{filename}: Filename too long - {filename_in_csv}")
invalid_filename_found = True
if invalid_filename_found:
return 1
else:
return 0


def checkFilenameLengths():
print("SOUNDS: Checking file name lengths ...")
invalid_filename_found = False
Expand Down Expand Up @@ -102,8 +134,8 @@ def checkForDuplicateStringID():
for filename in voiceFiles:
f = os.path.join(csv_directory, filename)
if os.path.isfile(f):
with open(f, 'rt') as csvfile:
reader = csv.reader(csvfile, delimiter=',', quotechar='"')
with open(f, "rt") as csvfile:
reader = csv.reader(csvfile, delimiter=",", quotechar='"')
line_count = 0
StringID_count = {}
for row in reader:
Expand All @@ -113,7 +145,7 @@ def checkForDuplicateStringID():
else:
StringID = row[0]
if StringID in StringID_count.keys():
print(f'{f}: {StringID} is duplicated')
print(f"{f}: {StringID} is duplicated")
StringID_count[StringID] = StringID_count[StringID] + 1
duplicate_found = True
else:
Expand All @@ -125,13 +157,32 @@ def checkForDuplicateStringID():
return 0


def checkCSVNewline():
print("VOICES: Checking CSV files for newline at the end of file ...")
missing_newline = False
for filename in os.listdir(csv_directory):
f = os.path.join(csv_directory, filename)
if os.path.isfile(f) and filename.endswith(".csv"):
with open(f, "r") as file:
lines = file.readlines()
if lines and not lines[-1].endswith("\n"):
print(f"{filename}: Missing newline at end of file")
missing_newline = True
if missing_newline:
return 1
else:
return 0


if __name__ == "__main__":
error_count = 0
error_count += checkCSVcolumnCount()
error_count += checkFilenameLengthsInCSV()
error_count += checkFilenameLengths()
error_count += checkNoZeroByteFiles()
error_count += validateSoundsJson()
error_count += checkForDuplicateStringID()
error_count += checkCSVNewline()

if error_count > 0:
sys.exit(os.EX_DATAERR)
Expand Down
10 changes: 9 additions & 1 deletion voices/en-GB.csv
Original file line number Diff line number Diff line change
Expand Up @@ -490,4 +490,12 @@
"489","Throttle enabled","Throttle enabled","car","","thren.wav"
"490","Throttle disabled","Throttle disabled","car","","thrdis.wav"
"491","Winch enabled","Winch enabled","car","","wchen.wav"
"492","Winch disabled","Winch disabled","car","","wchdis.wav"
"492","Winch disabled","Winch disabled","car","","wchdis.wav"
"493","Drift mode on","Drift mode on","car","","drifon.wav"
"494","Drift mode off","Drift mode off","car","","drifof.wav"
"495","Gyro enabled","Gyro enabled","","","gyroon.wav"
"496","Gyro disabled","Gyro disabled","","","gyroof.wav"
"497","Launch control active","Launch control active","","","launch.wav"
"498","Wet mode enabled","Wet mode enabled","","","wetmde.wav"
"500","Max gyro","Max gyro","","","maxgyr.wav"
"501","Max assistance","Max assistance","","","maxast.wav"
10 changes: 9 additions & 1 deletion voices/en-US.csv
Original file line number Diff line number Diff line change
Expand Up @@ -490,4 +490,12 @@
"489","Throttle enabled","Throttle enabled","car","","thren.wav"
"490","Throttle disabled","Throttle disabled","car","","thrdis.wav"
"491","Winch enabled","Winch enabled","car","","wchen.wav"
"492","Winch disabled","Winch disabled","car","","wchdis.wav"
"492","Winch disabled","Winch disabled","car","","wchdis.wav"
"493","Drift mode on","Drift mode on","car","","drifon.wav"
"494","Drift mode off","Drift mode off","car","","drifof.wav"
"495","Gyro enabled","Gyro enabled","","","gyroon.wav"
"496","Gyro disabled","Gyro disabled","","","gyroof.wav"
"497","Launch control active","Launch control active","","","launch.wav"
"498","Wet mode enabled","Wet mode enabled","","","wetmde.wav"
"500","Max gyro","Max gyro","","","maxgyr.wav"
"501","Max assistance","Max assistance","","","maxast.wav"
2 changes: 1 addition & 1 deletion voices/pt-PT.csv
Original file line number Diff line number Diff line change
Expand Up @@ -473,4 +473,4 @@
"482","Motor armed","motor armado","soaretx","","motarm.wav"
"483","Power","potência","soaretx","","power.wav"
"484","Speed","velocidade","soaretx","","speed.wav"
"485","Thermal","termal","soaretx","","therml.wav"
"485","Thermal","termal","soaretx","","therml.wav"

0 comments on commit 3769c75

Please sign in to comment.