From 090743aacbc4d8a6ebadb2127d1ffe325c6aaecd Mon Sep 17 00:00:00 2001 From: Grant Sanderson Date: Sat, 23 Jan 2021 11:02:02 -0800 Subject: [PATCH] Fix how sound files are found --- manimlib/utils/directories.py | 4 ++++ manimlib/utils/sounds.py | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/manimlib/utils/directories.py b/manimlib/utils/directories.py index 346312a0..e5629140 100644 --- a/manimlib/utils/directories.py +++ b/manimlib/utils/directories.py @@ -36,5 +36,9 @@ def get_vector_image_dir(): return get_directories()["vector_images"] +def get_sound_dir(): + return get_directories()["sounds"] + + def get_shader_dir(): return get_directories()["shaders"] diff --git a/manimlib/utils/sounds.py b/manimlib/utils/sounds.py index 9b349a7c..2cc8a124 100644 --- a/manimlib/utils/sounds.py +++ b/manimlib/utils/sounds.py @@ -1,5 +1,6 @@ import os from manimlib.utils.file_ops import find_file +from manimlib.utils.directories import get_sound_dir def play_chord(*nums): @@ -19,7 +20,7 @@ def play_chord(*nums): ] try: os.system(" ".join(commands)) - except: + except Exception: pass @@ -34,6 +35,6 @@ def play_finish_sound(): def get_full_sound_file_path(sound_file_name): return find_file( sound_file_name, - directories=[os.path.join("assets", "sounds")], + directories=[get_sound_dir()], extensions=[".wav", ".mp3"] )