mirror of
https://github.com/facefusion/facefusion.git
synced 2026-07-10 20:33:43 +02:00
Add testing for audio handlers
This commit is contained in:
+22
-22
@@ -62,6 +62,12 @@ def is_directory(directory_path : str) -> bool:
|
||||
return bool(directory_path and os.path.isdir(directory_path))
|
||||
|
||||
|
||||
def is_audio(audio_path : str) -> bool:
|
||||
if is_file(audio_path):
|
||||
return filetype.helpers.is_audio(audio_path)
|
||||
return False
|
||||
|
||||
|
||||
def is_image(image_path : str) -> bool:
|
||||
if is_file(image_path):
|
||||
return filetype.helpers.is_image(image_path)
|
||||
@@ -80,21 +86,13 @@ def is_video(video_path : str) -> bool:
|
||||
return False
|
||||
|
||||
|
||||
def is_audio(audio_path : str) -> bool:
|
||||
if is_file(audio_path):
|
||||
return filetype.helpers.is_audio(audio_path)
|
||||
return False
|
||||
|
||||
|
||||
def resolve_relative_path(path : str) -> str:
|
||||
return os.path.abspath(os.path.join(os.path.dirname(__file__), path))
|
||||
|
||||
|
||||
def list_directory(directory_path : str) -> Optional[List[str]]:
|
||||
if is_directory(directory_path):
|
||||
files = os.listdir(directory_path)
|
||||
return [ Path(file).stem for file in files if not Path(file).stem.startswith(('.', '__')) ]
|
||||
return None
|
||||
def filter_audio_paths(paths : List[str]) -> List[Optional[str]]:
|
||||
audio_paths = []
|
||||
if paths:
|
||||
for path in paths:
|
||||
if is_audio(path):
|
||||
audio_paths.append(path)
|
||||
return audio_paths
|
||||
|
||||
|
||||
def filter_image_paths(paths : List[str]) -> List[Optional[str]]:
|
||||
@@ -106,10 +104,12 @@ def filter_image_paths(paths : List[str]) -> List[Optional[str]]:
|
||||
return image_paths
|
||||
|
||||
|
||||
def filter_audio_paths(paths : List[str]) -> List[Optional[str]]:
|
||||
audio_paths = []
|
||||
if paths:
|
||||
for path in paths:
|
||||
if is_audio(path):
|
||||
audio_paths.append(path)
|
||||
return audio_paths
|
||||
def resolve_relative_path(path : str) -> str:
|
||||
return os.path.abspath(os.path.join(os.path.dirname(__file__), path))
|
||||
|
||||
|
||||
def list_directory(directory_path : str) -> Optional[List[str]]:
|
||||
if is_directory(directory_path):
|
||||
files = os.listdir(directory_path)
|
||||
return [ Path(file).stem for file in files if not Path(file).stem.startswith(('.', '__')) ]
|
||||
return None
|
||||
|
||||
Reference in New Issue
Block a user