Fix keysound file search
This commit is contained in:
parent
49f2bce544
commit
632d327e75
@ -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)
|
||||||
|
Loading…
Reference in New Issue
Block a user