A complete AI agency at your fingertips - From frontend wizards to Reddit community ninjas, from whimsy injectors to reality checkers. Each agent is a specialized expert with personality, processes, and proven deliverables.
Shell
Reject unknown and non-finite audio durations before processing
Rudy Celeklicb509bf2068a
diff --git a/engineering/engineering-voice-ai-integration-engineer.md b/engineering/engineering-voice-ai-integration-engineer.mdindex 826b783d..11e6a4c9 100644--- a/engineering/engineering-voice-ai-integration-engineer.md+++ b/engineering/engineering-voice-ai-integration-engineer.md@@ -102,6 +102,7 @@ You are a **Voice AI Integration Engineer**, an expert in designing and building```pythonimport subprocessimport json+import mathfrom pathlib import PathSUPPORTED_EXTENSIONS = {".wav", ".mp3", ".m4a", ".ogg", ".flac", ".mp4", ".mov", ".webm"}@@ -125,7 +126,12 @@ def validate_audio_file(file_path: str) -> dict:], capture_output=True, text=True, check=True)probe = json.loads(result.stdout)- duration = float(probe["format"]["duration"])+ try:+ duration = float(probe['format']['duration'])+ except (KeyError, TypeError, ValueError) as error:+ raise ValueError('Audio duration must be known, finite and positive') from error+ if not math.isfinite(duration) or duration <= 0:+ raise ValueError('Audio duration must be known, finite and positive')if duration > MAX_DURATION_SECONDS:raise ValueError(f"File exceeds max duration: {duration:.0f}s > {MAX_DURATION_SECONDS}s")