Files
wavinfo/tests/utils.py
2026-09-17 14:13:04 -07:00

24 lines
650 B
Python

import json
import os.path
import subprocess
FFPROBE = "ffprobe"
def ffprobe(path):
arguments = [FFPROBE, "-of", "json", "-show_format", "-show_streams", path]
process = subprocess.run(arguments, check=True, capture_output=True)
if process.returncode == 0:
output_str = process.stdout.decode("utf-8")
return json.loads(output_str)
else:
return None
def all_files():
for dirpath, _, filenames in os.walk("tests/test_files"):
for filename in filenames:
_, ext = os.path.splitext(filename)
if ext in [".wav", ".WAV"]:
yield os.path.join(dirpath, filename)