Update project files

This commit is contained in:
Thales Maciel 2026-02-10 11:01:36 -03:00
parent ad66a0d3cb
commit a17c234360
14 changed files with 952 additions and 529 deletions

View file

@ -13,9 +13,7 @@ class RecordResult:
temp_dir: str
def _resolve_ffmpeg_path(explicit: str) -> str:
if explicit:
return explicit
def _resolve_ffmpeg_path() -> str:
appdir = os.getenv("APPDIR")
if appdir:
candidate = Path(appdir) / "usr" / "bin" / "ffmpeg"
@ -34,7 +32,7 @@ def _ffmpeg_input_args(spec: str) -> list[str]:
return ["-f", kind, "-i", name]
def start_recording(ffmpeg_input: str, ffmpeg_path: str) -> tuple[subprocess.Popen, RecordResult]:
def start_recording(ffmpeg_input: str) -> tuple[subprocess.Popen, RecordResult]:
tmpdir = tempfile.mkdtemp(prefix="lel-")
wav = str(Path(tmpdir) / "mic.wav")
@ -43,7 +41,7 @@ def start_recording(ffmpeg_input: str, ffmpeg_path: str) -> tuple[subprocess.Pop
args += ["-ac", "1", "-ar", "16000", "-c:a", "pcm_s16le", wav]
proc = subprocess.Popen(
[_resolve_ffmpeg_path(ffmpeg_path), *args],
[_resolve_ffmpeg_path(), *args],
preexec_fn=os.setsid,
)
return proc, RecordResult(wav_path=wav, temp_dir=tmpdir)