Skip to content

Commit

Permalink
feat: Add camera control phrases (#71)
Browse files Browse the repository at this point in the history
* Add camera control phrases
Resolves #70

* typo

* Add "Recording start" and "Recording stop"

* Add "start recording" and "stop recording"

* Somebody can't count

* Add StringID duplicate build check
  • Loading branch information
pfeerick authored Jul 3, 2023
1 parent 44ece40 commit bdc3835
Show file tree
Hide file tree
Showing 57 changed files with 95 additions and 6 deletions.
Binary file added SOUNDS/en/cmode.wav
Binary file not shown.
Binary file added SOUNDS/en/cpower.wav
Binary file not shown.
Binary file added SOUNDS/en/cstart.wav
Binary file not shown.
Binary file added SOUNDS/en/cstop.wav
Binary file not shown.
Binary file added SOUNDS/en/cwifi.wav
Binary file not shown.
Binary file added SOUNDS/en/recsrt.wav
Binary file not shown.
Binary file added SOUNDS/en/recstp.wav
Binary file not shown.
Binary file added SOUNDS/en/stoprc.wav
Binary file not shown.
Binary file added SOUNDS/en/strtrc.wav
Binary file not shown.
Binary file added SOUNDS/en_gb-libby/cmode.wav
Binary file not shown.
Binary file added SOUNDS/en_gb-libby/cpower.wav
Binary file not shown.
Binary file added SOUNDS/en_gb-libby/cstart.wav
Binary file not shown.
Binary file added SOUNDS/en_gb-libby/cstop.wav
Binary file not shown.
Binary file added SOUNDS/en_gb-libby/cwifi.wav
Binary file not shown.
Binary file added SOUNDS/en_gb-libby/recsrt.wav
Binary file not shown.
Binary file added SOUNDS/en_gb-libby/recstp.wav
Binary file not shown.
Binary file added SOUNDS/en_gb-libby/stoprc.wav
Binary file not shown.
Binary file added SOUNDS/en_gb-libby/strtrc.wav
Binary file not shown.
Binary file added SOUNDS/en_gb-ryan/cmode.wav
Binary file not shown.
Binary file added SOUNDS/en_gb-ryan/cpower.wav
Binary file not shown.
Binary file added SOUNDS/en_gb-ryan/cstart.wav
Binary file not shown.
Binary file added SOUNDS/en_gb-ryan/cstop.wav
Binary file not shown.
Binary file added SOUNDS/en_gb-ryan/cwifi.wav
Binary file not shown.
Binary file added SOUNDS/en_gb-ryan/recsrt.wav
Binary file not shown.
Binary file added SOUNDS/en_gb-ryan/recstp.wav
Binary file not shown.
Binary file added SOUNDS/en_gb-ryan/stoprc.wav
Binary file not shown.
Binary file added SOUNDS/en_gb-ryan/strtrc.wav
Binary file not shown.
Binary file added SOUNDS/en_us-guy/cmode.wav
Binary file not shown.
Binary file added SOUNDS/en_us-guy/cpower.wav
Binary file not shown.
Binary file added SOUNDS/en_us-guy/cstart.wav
Binary file not shown.
Binary file added SOUNDS/en_us-guy/cstop.wav
Binary file not shown.
Binary file added SOUNDS/en_us-guy/cwifi.wav
Binary file not shown.
Binary file added SOUNDS/en_us-guy/recsrt.wav
Binary file not shown.
Binary file added SOUNDS/en_us-guy/recstp.wav
Binary file not shown.
Binary file added SOUNDS/en_us-guy/stoprc.wav
Binary file not shown.
Binary file added SOUNDS/en_us-guy/strtrc.wav
Binary file not shown.
Binary file added SOUNDS/en_us-michelle/cmode.wav
Binary file not shown.
Binary file added SOUNDS/en_us-michelle/cpower.wav
Binary file not shown.
Binary file added SOUNDS/en_us-michelle/cstart.wav
Binary file not shown.
Binary file added SOUNDS/en_us-michelle/cstop.wav
Binary file not shown.
Binary file added SOUNDS/en_us-michelle/cwifi.wav
Binary file not shown.
Binary file added SOUNDS/en_us-michelle/recsrt.wav
Binary file not shown.
Binary file added SOUNDS/en_us-michelle/recstp.wav
Binary file not shown.
Binary file added SOUNDS/en_us-michelle/stoprc.wav
Binary file not shown.
Binary file added SOUNDS/en_us-michelle/strtrc.wav
Binary file not shown.
Binary file added SOUNDS/en_us-sara/cmode.wav
Binary file not shown.
Binary file added SOUNDS/en_us-sara/cpower.wav
Binary file not shown.
Binary file added SOUNDS/en_us-sara/cstart.wav
Binary file not shown.
Binary file added SOUNDS/en_us-sara/cstop.wav
Binary file not shown.
Binary file added SOUNDS/en_us-sara/cwifi.wav
Binary file not shown.
Binary file added SOUNDS/en_us-sara/recsrt.wav
Binary file not shown.
Binary file added SOUNDS/en_us-sara/recstp.wav
Binary file not shown.
Binary file added SOUNDS/en_us-sara/stoprc.wav
Binary file not shown.
Binary file added SOUNDS/en_us-sara/strtrc.wav
Binary file not shown.
83 changes: 77 additions & 6 deletions build-checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,57 +10,128 @@

# TODO: Check for duplicate filenames in CSV files
# TODO: Check for files in SOUNDS that are not in CSV files
# TODO: Check CSV for correct row indexes


def checkCSVcolumnCount():
print("VOICES: Checking CSV files for missing fields ...")
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'):
reader = csv.reader(open(f, "r"))
for row in reader:
if not len(row) == 6:
print("{}: Insufficient columns of data - {}".format(filename, row))
missing_csv_field = True
continue

if missing_csv_field:
return 1
else:
return 0

def checkFilenameLengths():
print("SOUNDS: Checking file name lengths ...")
invalid_filename_found = False
for dirpath, dirnames, filenames in os.walk(sound_directory):
for fn in filenames:
path = os.path.join(dirpath, fn)
if path.split(os.path.sep)[2] == "SYSTEM":
if len(os.path.splitext(fn)[0]) > 8:
print("Filename too long for a SYSTEM file: {}".format(path))
invalid_filename_found = True
elif path.split(os.path.sep)[2] == "SCRIPTS":
continue
elif len(os.path.splitext(fn)[0]) > 6:
print("Filename too long for a non-SYSTEM file: {}".format(path))
invalid_filename_found = True

if invalid_filename_found:
return 1
else:
return 0


def checkNoZeroByteFiles():
print("SOUNDS: Checking for zero byte sound files ...")
zero_byte_file_found = False
for root, dirs, files in os.walk(sound_directory):
path = root.split(os.sep)
for fn in files:
path = os.path.join(root, fn)
if os.stat(path).st_size == 0:
print("Zero byte file: {}".format(path))
zero_byte_file_found = True

if zero_byte_file_found:
return 1
else:
return 0


def validateSoundsJson():
print("SOUNDS: Validating sounds.json ...")
invalid_json_found = False
f = open("sounds.json")
try:
json.load(f)
except ValueError as err:
print("JSON not valid: {}".format(str(err)))
return True
invalid_json_found = True

if invalid_json_found:
return 1
else:
return 0

def checkForDuplicateStringID():
print("VOICES: Check for duplicate StringIDs ...")
duplicate_found = False
pathName = os.path.join(os.getcwd(), csv_directory)

voiceFiles = []
# scan for voice CSV files
fileNames = os.listdir(pathName)
for fileNames in fileNames:
if fileNames.endswith(".csv"):
voiceFiles.append(fileNames)

# iterate over files found
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='"')
line_count = 0
StringID_count = {}
for row in reader:
if line_count == 0:
# absorb header row
line_count += 1
else:
StringID = row[0]
if StringID in StringID_count.keys():
print('{}: {} is duplicated'.format(f, StringID))
StringID_count[StringID] = StringID_count[StringID] + 1
duplicate_found = True
else:
StringID_count[StringID] = 1

if duplicate_found:
return 1
else:
return 0


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

if error_count > 0:
sys.exit(os.EX_DATAERR)
else:
sys.exit(os.EX_OK)
9 changes: 9 additions & 0 deletions voices/en-GB.csv
Original file line number Diff line number Diff line change
Expand Up @@ -441,3 +441,12 @@
"440","VTX Maximum Power","VTX Maximum Power","video","","vtxmax.wav"
"441","blackbox erase","blackbox erase","","","blkers.wav"
"442","acro trainer mode","acro trainer mode","","","actnmd.wav"
"443","Camera wifi button","Camera wifi button","camera","","cwifi.wav"
"444","Camera power button","Camera power button","camera","","cpower.wav"
"445","Camera change mode","Camera change mode","camera","","cmode.wav"
"446","Camera start","Camera start","camera","","cstart.wav"
"447","Camera stop","Camera stop","camera","","cstop.wav"
"448","Recording start","Recording start","","","recsrt.wav"
"449","Recording stop","Recording stop","","","recstp.wav"
"450","Start recording","Start recording","","","strtrc.wav"
"451","Stop recording","Stop recording","","","stoprc.wav"
9 changes: 9 additions & 0 deletions voices/en-US.csv
Original file line number Diff line number Diff line change
Expand Up @@ -441,3 +441,12 @@
"440","VTX Maximum Power","VTX Maximum Power","video","","vtxmax.wav"
"441","blackbox erase","blackbox erase","","","blkers.wav"
"442","acro trainer mode","acro trainer mode","","","actnmd.wav"
"443","Camera wifi button","Camera wifi button","camera","","cwifi.wav"
"444","Camera power button","Camera power button","camera","","cpower.wav"
"445","Camera change mode","Camera change mode","camera","","cmode.wav"
"446","Camera start","Camera start","camera","","cstart.wav"
"447","Camera stop","Camera stop","camera","","cstop.wav"
"448","Recording start","Recording start","","","recsrt.wav"
"449","Recording stop","Recording stop","","","recstp.wav"
"450","Start recording","Start recording","","","strtrc.wav"
"451","Stop recording","Stop recording","","","stoprc.wav"

0 comments on commit bdc3835

Please sign in to comment.