3
0
mirror of synced 2024-11-23 23:00:58 +01:00

Fix keysound file search

This commit is contained in:
Shinrin Ouja Moriking 2023-08-04 22:10:53 -06:00
parent 49f2bce544
commit 632d327e75

View File

@ -540,6 +540,7 @@ def generate_preview(input_filename, output_filename, offset, duration):
def get_real_keysound_filename(input_filename, keysounds_folder): def get_real_keysound_filename(input_filename, keysounds_folder):
if not input_filename: if not input_filename:
return None return None
@ -548,13 +549,14 @@ def get_real_keysound_filename(input_filename, keysounds_folder):
if os.path.exists(target_path): if os.path.exists(target_path):
# The file exists already # The file exists already
return target_path return target_path
extensions = [".wav",".ogg"]
# The file doesn't exist, so try to match it with other extensions # The file doesn't exist, so try to match it with other extensions
target_path = os.path.join(keysounds_folder, "%s.*" % (os.path.splitext(input_filename)[0])) for extension in extensions:
found_files = insensitive_glob(target_path) target_path = os.path.join(keysounds_folder, ("%s"+ extension) % (os.path.splitext(input_filename)[0]))
if os.path.exists(target_path):
if found_files: # The file exists already
return found_files[0] return target_path
print("Couldn't find", input_filename) print("Couldn't find", input_filename)