One folder per meeting (out/<name>/source.*, transcript.txt, meta.json, logs/), out/_global; speaker transcript from DB; throwaway Edge profile; skip shots only when all images exist

This commit is contained in:
Stefano Zini
2026-11-03 16:02:05 +01:00
parent a479853372
commit f855768f1f
11 changed files with 85 additions and 76 deletions
+22 -5
View File
@@ -5,6 +5,8 @@ from pathlib import Path
HERE = Path(__file__).parent
OUT = HERE / "out"
DB = OUT / "meetings.db"
GLOBAL = OUT / "_global" # llm.txt, step_stats.json, transcribe_device.txt, prefect/embed/llama logs, edge profile
GLOBAL.mkdir(parents=True, exist_ok=True)
SCHEMA = """
CREATE TABLE IF NOT EXISTS recordings(
@@ -95,11 +97,27 @@ def out_dir(name) -> Path:
return d
def logs(name) -> Path:
d = out_dir(name) / "logs"
d.mkdir(exist_ok=True)
return d
def meta(name) -> dict:
"""out/<name>/meta.json: {"title": manual title, "upload": original filename}; absent keys = not set."""
return _jload(OUT / name / "meta.json", {})
def set_meta(name, **kw):
m = {**meta(name), **kw}
_jsave(out_dir(name) / "meta.json", {k: v for k, v in m.items() if v})
# ---- progress + ETA (flow writes out/<name>/progress.json, server reads it) ----
ORDER = ["audio", "transcribing", "diarizing", "identifying", "shots", "docs", "report", "memory"] # step statuses
FROM = {"audio": "audio", "transcribe": "transcribing", "diarize": "diarizing", "speakers": "identifying",
"shots": "shots", "docs": "docs", "report": "report", "memory": "memory", "render": "memory"}
STATS = OUT / "step_stats.json"
STATS = GLOBAL / "step_stats.json"
# seconds of work per minute of audio, measured 2026-11-02 on RTX 500 Ada 4 GB + Core Ultra 7 155H (40-min call);
# replaced by a moving average of real runs as soon as one finishes (keys "<step>" or "<step>@<model>")
SPM = {"audio": 1, "transcribing": 6, "diarizing": 9, "identifying": 1, "shots@qwen4b": 23, "shots@qwen35b": 48, "shots": 30,
@@ -122,13 +140,12 @@ def spm(key):
def delete_recording(name):
"""Remove a meeting everywhere: DB rows in every table keyed by name, out/<name>/ and out/<name>.* files."""
"""Remove a meeting everywhere: DB rows in every table keyed by name, and the folder out/<name>/."""
import shutil
c = connect()
for t in ("recordings", "lines", "shots", "shot_text", "topics", "call_events", "speaker_map", "memory"):
c.execute(f"DELETE FROM {t} WHERE name=?", (name,))
shutil.rmtree(OUT / name, ignore_errors=True)
for p in OUT.glob(f"{name}.*"): p.unlink(missing_ok=True)
def progress(name):
@@ -169,11 +186,11 @@ def tick(name, done, total, note=""):
def media(name):
"""(audio source, video source) in out/<name>/: source.<ext> (the CLI recorder may write source.wav + source.mp4); .wav/.m4a/.mp3 have no video."""
def first(*exts):
for e in exts:
p = OUT / f"{name}{e}"
p = OUT / name / f"source{e}"
if p.exists(): return p
# audio source, video source; .mkv/.mov/.m4a/.mp3 come from GUI uploads (meet_*)
return first(".webm", ".wav", ".mp4", ".mkv", ".mov", ".m4a", ".mp3"), first(".webm", ".mp4", ".mkv", ".mov")