Update project files
This commit is contained in:
parent
ad66a0d3cb
commit
a17c234360
14 changed files with 952 additions and 529 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue