Initial commit
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
# Helper functions for mknotes
|
||||
|
||||
import os
|
||||
|
||||
def find_audio_files(directory, extensions=(".mp3", ".m4a")):
|
||||
"""
|
||||
Recursively find all audio files in the given directory with the specified extensions.
|
||||
Returns a list of file paths.
|
||||
"""
|
||||
audio_files = []
|
||||
for root, _, files in os.walk(directory):
|
||||
for file in files:
|
||||
if file.lower().endswith(extensions):
|
||||
audio_files.append(os.path.join(root, file))
|
||||
return audio_files
|
||||
|
||||
def ensure_directory_exists(directory):
|
||||
"""
|
||||
Create the directory if it does not exist.
|
||||
"""
|
||||
os.makedirs(directory, exist_ok=True)
|
||||
Reference in New Issue
Block a user