Open-source AI podcast clipper. Generate vertical clips with face tracking and burned-in captions. CLI, MCP server, web app.
Python ai-toolsauto-captionscaptionscliffmpegmcpmcp-serveropusclip-alternativepodcast-clipspodcastsshortform-videovertical-videowhisper
feat: word corrections, full presets, questionary interactive CLI
Nika Siradze598c91510282
diff --git a/backend/cli.py b/backend/cli.pyindex 7a08639..c5c8349 100644--- a/backend/cli.py+++ b/backend/cli.py@@ -118,11 +118,6 @@ def cmd_process(args):from services.encoder import get_encoder_infofrom presets import get_preset, DEFAULT_PRESET- video_path = _clean_path(args.video)- if not os.path.exists(video_path):- print(f"Error: Video not found: {video_path}", file=sys.stderr)- sys.exit(1)-# Load preset or defaultsif args.preset:try:@@ -134,6 +129,31 @@ def cmd_process(args):else:config = {**DEFAULT_PRESET}+ # Resolve video path: CLI arg > preset > error+ if args.video:+ video_path = _clean_path(args.video)+ elif config.get("video_path"):+ video_path = _clean_path(config["video_path"])+ else:+ print(f"Error: No video specified. Provide a path or use a preset with video_path.", file=sys.stderr)+ sys.exit(1)++ if not os.path.exists(video_path):+ print(f"Error: Video not found: {video_path}", file=sys.stderr)+ sys.exit(1)++ # Resolve transcript from preset if not given on CLI+ if not args.transcript and config.get("transcript_path"):+ args.transcript = config["transcript_path"]++ # Apply preset corrections (merged with global corrections)+ if config.get("corrections"):+ from services.corrections import get_corrections, save_corrections+ global_corr = get_corrections()+ merged = {**global_corr, **config["corrections"]}+ if merged != global_corr:+ save_corrections(merged)+# CLI overridesif args.caption_style:config["caption_style"] = args.caption_style@@ -182,8 +202,8 @@ def cmd_process(args):quality = config.get("quality", os.environ.get("PODCLI_QUALITY", "max"))os.environ["PODCLI_QUALITY"] = quality- # Output directory- output_dir = args.output or os.path.join(os.path.dirname(video_path), "clips")+ # Output directory: CLI arg > preset > default+ output_dir = args.output or config.get("output_dir") or os.path.join(os.path.dirname(video_path), "clips")os.makedirs(output_dir, exist_ok=True)enc_info = get_encoder_info()@@ -306,6 +326,10 @@ def cmd_process(args):# Save to cache for next run_save_cache(video_path, result)+ # Apply word corrections (Whisper misheard proper nouns, brand names)+ from services.corrections import apply_corrections+ apply_corrections(words, segments)+# Extract face_map before result gets overwritten in clip loopface_map = result.get("face_map")@@ -829,32 +853,89 @@ def cmd_presets(args):"""Manage presets."""from presets import list_presets, get_preset, save_preset, delete_preset+ accent = "\033[38;2;212;135;74m"+ green = "\033[38;2;74;222;128m"+ gray = "\033[38;5;245m"+ bold = "\033[1m"+ reset = "\033[0m"+if args.presets_action == "list":presets = list_presets()if not presets:- print(" No saved presets. Create one with: podcli presets save <name>")+ print(f"\n No saved presets. Create one:")+ print(f" {accent}podcli presets save myshow --video ep.mp4 --caption-style branded --logo mylogo{reset}\n")return- print(f"\n Saved presets ({len(presets)}):\n")+ print(f"\n {bold}Presets ({len(presets)}){reset}\n")for p in presets:- print(f" {p['name']}")- print(f" caption: {p.get('caption_style', '?')} | crop: {p.get('crop_strategy', '?')} | top: {p.get('top_clips', '?')}")+ video_tag = f" · {gray}{os.path.basename(p['video_path'])}{reset}" if p.get("video_path") else ""+ corr_tag = f" · {gray}{len(p['corrections'])} corrections{reset}" if p.get("corrections") else ""+ print(f" {accent}{p['name']}{reset}{video_tag}{corr_tag}")+ parts = []+ if p.get("caption_style"):+ parts.append(p["caption_style"])+ if p.get("crop_strategy"):+ parts.append(p["crop_strategy"])+ if p.get("logo_path"):+ parts.append(f"logo: {os.path.basename(p['logo_path'])}")+ if p.get("quality"):+ parts.append(p["quality"])+ if parts:+ print(f" {gray}{' · '.join(parts)}{reset}")print()elif args.presets_action == "save":- config = {}+ # Load existing preset to merge (so you can update one field at a time)+ try:+ existing = get_preset(args.name)+ existing.pop("name", None)+ except FileNotFoundError:+ existing = {}++ config = {**existing}+ if args.video:+ config["video_path"] = _clean_path(args.video)+ if args.transcript:+ config["transcript_path"] = _clean_path(args.transcript)+ if args.output:+ config["output_dir"] = _clean_path(args.output)if args.caption_style:config["caption_style"] = args.caption_styleif args.crop:config["crop_strategy"] = args.cropif args.logo:- config["logo_path"] = args.logo+ from services.asset_store import resolve as _resolve_logo+ config["logo_path"] = _resolve_logo(args.logo) or args.logo+ if args.outro:+ from services.asset_store import resolve as _resolve_outro+ config["outro_path"] = _resolve_outro(args.outro) or args.outroif args.top:config["top_clips"] = args.topif args.time_adjust is not None:config["time_adjust"] = args.time_adjust+ if args.quality:+ config["quality"] = args.quality+ if args.no_energy:+ config["energy_boost"] = False+ if args.no_speakers:+ config["no_speakers"] = True+ if args.with_corrections:+ from services.corrections import get_corrections+ config["corrections"] = get_corrections()path = save_preset(args.name, config)- print(f" Preset '{args.name}' saved to {path}")+ print(f"\n {green}✓{reset} Preset '{accent}{args.name}{reset}' saved")+ # Show summary+ if config.get("video_path"):+ print(f" video: {gray}{config['video_path']}{reset}")+ if config.get("caption_style"):+ print(f" caption: {gray}{config['caption_style']}{reset}")+ if config.get("logo_path"):+ print(f" logo: {gray}{config['logo_path']}{reset}")+ if config.get("outro_path"):+ print(f" outro: {gray}{config['outro_path']}{reset}")+ if config.get("corrections"):+ print(f" corrections: {gray}{len(config['corrections'])} words{reset}")+ print()elif args.presets_action == "delete":if delete_preset(args.name):@@ -865,10 +946,16 @@ def cmd_presets(args):elif args.presets_action == "show":try:p = get_preset(args.name)- print(f"\n Preset: {args.name}\n")- for k, v in p.items():- if k != "name":- print(f" {k}: {v}")+ print(f"\n {bold}Preset: {accent}{args.name}{reset}\n")+ for k, v in sorted(p.items()):+ if k == "name" or v == "" or v == {} or v is None:+ continue+ if k == "corrections" and isinstance(v, dict):+ print(f" {gray}{k}:{reset} {len(v)} words")+ for wrong, correct in v.items():+ print(f" {gray}{wrong}{reset} → {green}{correct}{reset}")+ else:+ print(f" {gray}{k}:{reset} {v}")print()except FileNotFoundError:print(f" Preset '{args.name}' not found")@@ -977,6 +1064,47 @@ def cmd_thumbnails(args):print(f" {gray}Edit .podcli/thumbnail-config.json to customize colors, fonts, layout.{reset}\n")+def cmd_corrections(args):+ """Manage transcript word corrections."""+ from services.corrections import get_corrections, save_corrections++ accent = "\033[38;2;212;135;74m"+ green = "\033[38;2;74;222;128m"+ gray = "\033[38;5;245m"+ bold = "\033[1m"+ reset = "\033[0m"++ action = getattr(args, "corrections_action", None) or "list"++ if action == "list":+ corrections = get_corrections()+ if not corrections:+ print(f"\n {gray}No corrections set. Add one:{reset}")+ print(f" {accent}podcli corrections add \"Boxel\" \"Voxel\"{reset}\n")+ return+ print(f"\n {bold}Transcript corrections{reset} ({len(corrections)}):\n")+ for wrong, correct in sorted(corrections.items()):+ print(f" {gray}{wrong}{reset} → {green}{correct}{reset}")+ print()+ elif action == "add":+ wrong = args.wrong+ correct = args.correct+ corrections = get_corrections()+ corrections[wrong] = correct+ save_corrections(corrections)+ print(f"\n {green}✓{reset} Added: {gray}{wrong}{reset} → {green}{correct}{reset}")+ print(f" {gray}({len(corrections)} total corrections){reset}\n")+ elif action == "remove":+ wrong = args.wrong+ corrections = get_corrections()+ if wrong in corrections:+ del corrections[wrong]+ save_corrections(corrections)+ print(f"\n {green}✓{reset} Removed: {gray}{wrong}{reset}\n")+ else:+ print(f"\n {gray}Not found: {wrong}{reset}\n")++def cmd_cache(args):"""Manage transcription cache."""cache_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", ".podcli", "cache")@@ -1168,6 +1296,30 @@ def print_banner():except Exception:pass+ # Presets+ try:+ from presets import list_presets+ presets = list_presets()+ if presets:+ names = []+ for p in presets:+ tag = p["name"]+ if p.get("video_path") and os.path.exists(p["video_path"]):+ tag += f" {dim}({os.path.basename(p['video_path'])}){reset}{gray}"+ names.append(tag)+ print(f" {gray}Presets{reset} {gray}{' · '.join(names)}{reset}")+ except Exception:+ pass++ # Corrections count+ try:+ from services.corrections import get_corrections+ corr = get_corrections()+ if corr:+ print(f" {gray}Corrections{reset} {green}{len(corr)}{reset} {gray}words{reset}")+ except Exception:+ pass+print()if not speakers_ok:@@ -1197,6 +1349,7 @@ def print_help():print(f" {accent}assets{reset} {gray}<action>{reset} Manage logos, intros, outros")print(f" {accent}presets{reset} {gray}<action>{reset} Save/load rendering presets")print(f" {accent}thumbnails{reset} {gray}<title>{reset} Generate thumbnail variations")+ print(f" {accent}corrections{reset} {gray}<action>{reset} Fix Whisper misheard words (Boxel→Voxel)")print(f" {accent}cache{reset} {gray}[clear]{reset} Show/clear transcription cache")print(f" {accent}info{reset} Show system info (encoder, codecs)")print()@@ -1248,7 +1401,7 @@ def main():# ── process ──proc = sub.add_parser("process", help="Process a video into clips")- proc.add_argument("video", help="Path to podcast video file")+ proc.add_argument("video", nargs="?", default=None, help="Path to podcast video file (optional if preset has video_path)")proc.add_argument("-t", "--transcript", help="Path to transcript file (.txt or .json)")proc.add_argument("-n", "--top", type=int, help="Number of top clips to export (default: 5)")proc.add_argument("-o", "--output", help="Output directory (default: ./clips)")@@ -1271,11 +1424,19 @@ def main():pre_save = pre_sub.add_parser("save", help="Save a preset")pre_save.add_argument("name", help="Preset name")+ pre_save.add_argument("--video", help="Default video path")+ pre_save.add_argument("--transcript", help="Default transcript path")+ pre_save.add_argument("--output", help="Default output directory")pre_save.add_argument("--caption-style", choices=["branded", "hormozi", "karaoke", "subtle"])pre_save.add_argument("--crop", choices=["center", "face"])- pre_save.add_argument("--logo", help="Logo path")+ pre_save.add_argument("--logo", help="Logo (asset name or path)")+ pre_save.add_argument("--outro", help="Outro (asset name or path)")pre_save.add_argument("--top", type=int, help="Default top clips count")pre_save.add_argument("--time-adjust", type=float)+ pre_save.add_argument("--quality", choices=["low", "medium", "high", "max"])+ pre_save.add_argument("--no-energy", action="store_true", help="Skip audio energy analysis")+ pre_save.add_argument("--no-speakers", action="store_true", help="Skip speaker detection")+ pre_save.add_argument("--with-corrections", action="store_true", help="Include current global corrections in preset")pre_show = pre_sub.add_parser("show", help="Show a preset")pre_show.add_argument("name")@@ -1309,6 +1470,16 @@ def main():thumb.add_argument("--logo", help="Logo (asset name or path)")thumb.add_argument("-n", "--variations", type=int, default=3, help="Number of variations")+ # ── corrections ──+ corr = sub.add_parser("corrections", help="Manage transcript word corrections (Whisper fixes)")+ corr_sub = corr.add_subparsers(dest="corrections_action")+ corr_sub.add_parser("list", help="Show all corrections")+ corr_add = corr_sub.add_parser("add", help="Add a correction")+ corr_add.add_argument("wrong", help="Misheard word/phrase")+ corr_add.add_argument("correct", help="Correct replacement")+ corr_rm = corr_sub.add_parser("remove", help="Remove a correction")+ corr_rm.add_argument("wrong", help="Word to remove from corrections")+# ── cache ──cache_p = sub.add_parser("cache", help="Manage transcription cache")cache_sub = cache_p.add_subparsers(dest="cache_action")@@ -1334,6 +1505,8 @@ def main():cmd_presets(args)elif args.command == "assets":cmd_assets(args)+ elif args.command == "corrections":+ cmd_corrections(args)elif args.command == "cache":cmd_cache(args)elif args.command == "info":@@ -1361,37 +1534,59 @@ def interactive_menu():except Exception:pass- while True:- print(f" {bold}Quick start:{reset}")- print(f" {accent}1{reset} Process a video → shorts + content package")- print(f" {accent}2{reset} Open Web UI")- print(f" {accent}3{reset} Manage assets")- print(f" {accent}4{reset} Cache {gray}(view/clear transcription cache){reset}")- print(f" {accent}q{reset} Quit")- print()+ import questionary+ from questionary import Style- try:- raw = input(f" {accent}▸{reset} ")- choice = "".join(c for c in raw if c.isprintable()).strip()- except (EOFError, KeyboardInterrupt):- print()- return- if not choice:- continue+ qstyle = Style([+ ("qmark", "fg:#d4874a bold"),+ ("question", "bold"),+ ("answer", "fg:#4ade80"),+ ("pointer", "fg:#d4874a bold"),+ ("highlighted", "fg:#d4874a bold"),+ ("selected", "fg:#4ade80"),+ ("instruction", "fg:#a1a1aa"),+ ])- if choice == "1":+ while True:+ choice = questionary.select(+ "What do you want to do?",+ choices=[+ questionary.Choice("Process a video → shorts + content package", value="process"),+ questionary.Choice("Open Web UI", value="webui"),+ questionary.Choice("Manage assets", value="assets"),+ questionary.Choice("Manage presets", value="presets"),+ questionary.Choice("Word corrections (fix Whisper misheard words)", value="corrections"),+ questionary.Choice("Thumbnails (generate variations)", value="thumbnails"),+ questionary.Choice("Cache (view/clear transcription cache)", value="cache"),+ questionary.Choice("System info (encoder, codecs, AI CLI)", value="info"),+ questionary.Separator(),+ questionary.Choice("Quit", value="quit"),+ ],+ style=qstyle,+ instruction="(↑↓ to move, enter to select)",+ ).ask()++ if choice is None or choice == "quit":+ return+ elif choice == "process":_interactive_process()return- elif choice == "2":+ elif choice == "webui":print(f"\n {gray}Starting Web UI...{reset}\n")import subprocess as spsp.run(["npm", "run", "ui"], cwd=os.path.join(os.path.dirname(os.path.abspath(__file__)), ".."))- elif choice == "3":+ elif choice == "assets":_interactive_assets()- elif choice == "4":+ elif choice == "presets":+ _interactive_presets()+ elif choice == "corrections":+ _interactive_corrections()+ elif choice == "thumbnails":+ _interactive_thumbnails()+ elif choice == "cache":_interactive_cache()- elif choice in ("q", "Q"):- return+ elif choice == "info":+ _interactive_info()def _clean_path(val):@@ -1443,140 +1638,155 @@ def _ask(prompt, default=None, validate=None, required=False, is_path=False):def _interactive_process():- """Interactive video processing wizard. Simple input() calls, no abstraction."""+ """Interactive video processing wizard using questionary."""+ import questionary+ from questionary import Style- accent = "\033[38;2;212;135;74m"- gray = "\033[38;5;245m"green = "\033[38;2;74;222;128m"- red = "\033[38;2;248;113;113m"- bold = "\033[1m"+ gray = "\033[38;5;245m"dim = "\033[2m"reset = "\033[0m"- def _prompt(msg, default=None):- """Simple prompt. Returns stripped input or default."""- try:- val = input(msg).strip().strip("'\"")- if not val:- return default- return _clean_path(val) if ("/" in val or "\\" in val) else val- except (EOFError, KeyboardInterrupt):- print()- return default+ qstyle = Style([+ ("qmark", "fg:#d4874a bold"),+ ("question", "bold"),+ ("answer", "fg:#4ade80"),+ ("pointer", "fg:#d4874a bold"),+ ("highlighted", "fg:#d4874a bold"),+ ("selected", "fg:#4ade80"),+ ("instruction", "fg:#a1a1aa"),+ ])++ # Check for presets first+ from presets import list_presets, get_preset+ presets = list_presets()+ preset_choices = [p for p in presets if p.get("video_path")]++ use_preset = None+ if preset_choices:+ preset_options = [+ questionary.Choice(+ f"{p['name']} — {os.path.basename(p['video_path'])}",+ value=p["name"]+ ) for p in preset_choices+ ]+ preset_options.append(questionary.Choice("New video (manual setup)", value="_new"))+ use_preset = questionary.select(+ "Use a preset or set up manually?",+ choices=preset_options,+ style=qstyle,+ ).ask()+ if use_preset is None:+ return- # 1. Video- print(f"\n {bold}Drag your episode video here or paste the path:{reset}")- video = None- while not video:- v = _prompt(f" {accent}▸{reset} ")- if v is None:+ if use_preset and use_preset != "_new":+ # Run with preset+ config = get_preset(use_preset)+ video = config["video_path"]+ if not os.path.exists(video):+ print(f"\n Video not found: {video}")return- if not v:- continue- if os.path.exists(v):- video = v- print(f" {green}✓{reset} {os.path.basename(video)}")- else:- print(f" {red}✗{reset} File not found, try again")- # 2. Transcript- print(f"\n {bold}Transcript{reset} {dim}(drag file here, or just press Enter to auto-transcribe):{reset}")- t = _prompt(f" {accent}▸{reset} ", default="")- transcript = t if t and os.path.exists(t) else None- if transcript:- print(f" {green}✓{reset} {os.path.basename(transcript)}")- else:+ if questionary.confirm(+ f"Process {os.path.basename(video)} with preset '{use_preset}'?",+ default=True, style=qstyle,+ ).ask():+ cmd = [sys.executable, os.path.abspath(__file__), "process", "--preset", use_preset]+ sys.stdout.write("\033[2J\033[H")+ sys.stdout.flush()+ print(f" {green}▶{reset} Starting with preset '{use_preset}'...\n")+ import subprocess as _sp+ sys.exit(_sp.call(cmd))+ return++ # Manual setup+ video = questionary.path(+ "Video file:",+ style=qstyle,+ validate=lambda v: True if os.path.exists(_clean_path(v)) else "File not found",+ ).ask()+ if not video:+ return+ video = _clean_path(video)++ transcript = questionary.path(+ "Transcript (Enter to auto-transcribe):",+ style=qstyle,+ default="",+ ).ask()+ transcript = _clean_path(transcript) if transcript and os.path.exists(_clean_path(transcript)) else None+ if not transcript:print(f" {gray}→ Will auto-transcribe with Whisper{reset}")- # 3. Caption style- print(f"\n {bold}Caption style{reset} {dim}(1-4, default 1):{reset}")- print(f" {accent}1{reset} branded {dim}dark pill on active word + logo{reset}")- print(f" {accent}2{reset} hormozi {dim}bold uppercase, yellow highlight{reset}")- print(f" {accent}3{reset} karaoke {dim}sentence visible, words light up{reset}")- print(f" {accent}4{reset} subtle {dim}clean small text at bottom{reset}")- styles = {"1": "branded", "2": "hormozi", "3": "karaoke", "4": "subtle"}- caption_style = styles.get(_prompt(f" {accent}▸{reset} ", default="1") or "1", "branded")- print(f" {green}✓{reset} {caption_style}")-- # 4. Quality- print(f"\n {bold}Quality{reset} {dim}(1-4, default 3):{reset} {dim}1 low · 2 medium · 3 high · 4 max{reset}")- qualities = {"1": "low", "2": "medium", "3": "high", "4": "max"}- quality = qualities.get(_prompt(f" {accent}▸{reset} ", default="3") or "3", "high")- print(f" {green}✓{reset} {quality}")-- # 5. Number of clips- print(f"\n {bold}How many clips?{reset} {dim}(default 5):{reset}")- try:- top_n = int(_prompt(f" {accent}▸{reset} ", default="5") or "5")- except ValueError:- top_n = 5- print(f" {green}✓{reset} {top_n} clips")+ caption_style = questionary.select(+ "Caption style:",+ choices=[+ questionary.Choice("branded — dark pill on active word + logo", value="branded"),+ questionary.Choice("hormozi — bold uppercase, yellow highlight", value="hormozi"),+ questionary.Choice("karaoke — sentence visible, words light up", value="karaoke"),+ questionary.Choice("subtle — clean small text at bottom", value="subtle"),+ ],+ default="branded",+ style=qstyle,+ ).ask()+ if caption_style is None:+ return++ quality = questionary.select(+ "Quality:",+ choices=["low", "medium", "high", "max"],+ default="max",+ style=qstyle,+ ).ask()+ if quality is None:+ return++ top_n = questionary.text(+ "How many clips?",+ default="5",+ style=qstyle,+ validate=lambda v: True if v.isdigit() and int(v) > 0 else "Enter a number",+ ).ask()+ if top_n is None:+ return+ top_n = int(top_n)- # 6. Logo+ # Logologo = Nonetry:from services.asset_store import list_assetslogos = [a for a in list_assets() if a["type"] == "logo" and os.path.exists(a["path"])]if logos:- print(f"\n {bold}Logo{reset} {dim}(default 1):{reset}")- for i, a in enumerate(logos):- print(f" {accent}{i+1}{reset} {a['name']} {dim}{os.path.basename(a['path'])}{reset}")- print(f" {accent}0{reset} none")- lc = _prompt(f" {accent}▸{reset} ", default="1") or "1"- if lc != "0":- idx = int(lc) - 1- if 0 <= idx < len(logos):- logo = logos[idx]["path"]- print(f" {green}✓{reset} {logos[idx]['name']}")+ logo_choices = [questionary.Choice(f"{a['name']} ({os.path.basename(a['path'])})", value=a["path"]) for a in logos]+ logo_choices.append(questionary.Choice("None", value=None))+ logo = questionary.select("Logo:", choices=logo_choices, default=logo_choices[0], style=qstyle).ask()except Exception:pass- # 7. Outro+ # Outrooutro = Nonetry:- from services.asset_store import list_assets as list_assets_outro- outros = [a for a in list_assets_outro() if a["type"] == "video" and os.path.exists(a["path"])]+ from services.asset_store import list_assets as list_assets_o+ outros = [a for a in list_assets_o() if a["type"] == "video" and os.path.exists(a["path"])]if outros:- print(f"\n {bold}Outro{reset} {dim}(default 0 = none):{reset}")- for i, a in enumerate(outros):- print(f" {accent}{i+1}{reset} {a['name']} {dim}{os.path.basename(a['path'])}{reset}")- print(f" {accent}0{reset} none")- oc = _prompt(f" {accent}▸{reset} ", default="0") or "0"- if oc != "0":- idx = int(oc) - 1- if 0 <= idx < len(outros):- outro = outros[idx]["path"]- print(f" {green}✓{reset} {outros[idx]['name']}")- else:- print(f"\n {bold}Outro:{reset} {dim}(drag video or press Enter to skip):{reset}")- o = _prompt(f" {accent}▸{reset} ", default="")- if o:- o = _clean_path(o)- if os.path.exists(o):- outro = o- print(f" {green}✓{reset} {os.path.basename(outro)}")+ outro_choices = [questionary.Choice("None", value=None)]+ outro_choices += [questionary.Choice(f"{a['name']} ({os.path.basename(a['path'])})", value=a["path"]) for a in outros]+ outro = questionary.select("Outro:", choices=outro_choices, style=qstyle).ask()except Exception:pass- # Summary + confirm+ # Confirmprint(f"\n {'─' * 45}")- print(f" {bold}Video:{reset} {os.path.basename(video)}")- print(f" {bold}Style:{reset} {caption_style} · Quality: {quality} · Clips: {top_n}")+ print(f" Video: {os.path.basename(video)}")+ print(f" Style: {caption_style} · Quality: {quality} · Clips: {top_n}")if logo:- print(f" {bold}Logo:{reset} ✓")+ print(f" Logo: ✓")if outro:- print(f" {bold}Outro:{reset} ✓ {dim}{os.path.basename(outro)}{reset}")- print(f" {bold}Transcript:{reset} {'auto (Whisper)' if not transcript else os.path.basename(transcript)}")+ print(f" Outro: ✓ {dim}{os.path.basename(outro)}{reset}")+ print(f" Transcript: {'auto (Whisper)' if not transcript else os.path.basename(transcript)}")print()- sys.stdout.write(f" {green}Ready!{reset} {bold}Press Enter to start{reset} {dim}(q to cancel){reset} ")- sys.stdout.flush()- try:- confirm = sys.stdin.readline().strip()- except (EOFError, KeyboardInterrupt):- print(f"\n {gray}Cancelled.{reset}")- return- if confirm.lower() == "q":- print(f" {gray}Cancelled.{reset}")++ if not questionary.confirm("Start processing?", default=True, style=qstyle).ask():return# Run@@ -1591,92 +1801,355 @@ def _interactive_process():if outro:cmd += ["--outro", outro]- # Clear screen before starting processing to avoid prompt artifacts- sys.stdout.write("\033[2J\033[H") # clear screen + move cursor to top+ sys.stdout.write("\033[2J\033[H")sys.stdout.flush()print(f" {green}▶{reset} Starting...\n")sys.stderr.flush()- # Use subprocess instead of execv to avoid terminal state issuesimport subprocess as _sp- exit_code = _sp.call(cmd)- sys.exit(exit_code)+ sys.exit(_sp.call(cmd))def _interactive_cache():- """Interactive cache management."""+ """Interactive cache management using questionary."""import argparse as _ap- # Show status first- cmd_cache(_ap.Namespace(cache_action=None))+ import questionary+ from questionary import Style++ qstyle = Style([+ ("qmark", "fg:#d4874a bold"),+ ("question", "bold"),+ ("answer", "fg:#4ade80"),+ ("pointer", "fg:#d4874a bold"),+ ("highlighted", "fg:#d4874a bold"),+ ("selected", "fg:#4ade80"),+ ("instruction", "fg:#a1a1aa"),+ ])- accent = "\033[38;2;212;135;74m"- gray = "\033[38;5;245m"- reset = "\033[0m"-- try:- choice = input(f" {gray}Clear cache? (y/n/enter=back){reset} {accent}▸{reset} ").strip().lower()- except (EOFError, KeyboardInterrupt):- print()- return+ cmd_cache(_ap.Namespace(cache_action=None))- if choice in ("y", "yes"):+ if questionary.confirm("Clear cache?", default=False, style=qstyle).ask():cmd_cache(_ap.Namespace(cache_action="clear"))def _interactive_assets():- """Interactive asset management."""+ """Interactive asset management using questionary."""+ import questionary+ from questionary import Stylefrom services.asset_store import register, unregister, list_assets- accent = "\033[38;2;212;135;74m"- gray = "\033[38;5;245m"green = "\033[38;2;74;222;128m"+ gray = "\033[38;5;245m"red = "\033[38;2;248;113;113m"- bold = "\033[1m"- dim = "\033[2m"+ accent = "\033[38;2;212;135;74m"reset = "\033[0m"- # Show current assets first+ qstyle = Style([+ ("qmark", "fg:#d4874a bold"),+ ("question", "bold"),+ ("answer", "fg:#4ade80"),+ ("pointer", "fg:#d4874a bold"),+ ("highlighted", "fg:#d4874a bold"),+ ("selected", "fg:#4ade80"),+ ("instruction", "fg:#a1a1aa"),+ ])+current = list_assets()if current:- print(f"\n {bold}Registered assets:{reset}")+ print(f"\n Registered assets:")for a in current:exists = os.path.exists(a["path"])icon = f"{green}✓{reset}" if exists else f"{red}✗{reset}"print(f" {icon} {accent}{a['name']}{reset} {gray}({a['type']}) {os.path.basename(a['path'])}{reset}")- else:- print(f"\n {gray}No assets registered yet.{reset}")+ print()- print(f"\n {bold}Add asset{reset} {dim}(or press Enter to go back){reset}")+ actions = [questionary.Choice("Add asset", value="add")]+ if current:+ actions.append(questionary.Choice("Remove asset", value="remove"))+ actions.append(questionary.Choice("← Back", value="_back"))- # Get name- sys.stdout.write(f" Name: ")- sys.stdout.flush()- try:- name = sys.stdin.readline().strip()- except (EOFError, KeyboardInterrupt):- print()+ action = questionary.select("Assets:", choices=actions, style=qstyle).ask()+ if action is None or action == "_back":+ return++ if action == "add":+ name = questionary.text("Asset name (e.g. mylogo, outro):", style=qstyle).ask()+ if not name:+ return+ path = questionary.path("File path:", style=qstyle).ask()+ if not path:+ return+ path = _clean_path(path)+ try:+ asset = register(name, path)+ print(f"\n {green}✓{reset} Registered {accent}{name}{reset} ({asset['type']})")+ print(f" {gray}{asset['path']}{reset}\n")+ except FileNotFoundError as e:+ print(f"\n {red}✗{reset} {e}\n", file=sys.stderr)++ elif action == "remove":+ choices = [questionary.Choice(f"{a['name']} ({a['type']})", value=a["name"]) for a in current]+ to_remove = questionary.select("Remove which?", choices=choices, style=qstyle).ask()+ if to_remove:+ unregister(to_remove)+ print(f"\n {green}✓{reset} Removed '{to_remove}'\n")+++def _interactive_presets():+ """Interactive preset management using questionary."""+ import questionary+ from questionary import Style+ from presets import list_presets, get_preset, save_preset, delete_preset++ green = "\033[38;2;74;222;128m"+ accent = "\033[38;2;212;135;74m"+ reset = "\033[0m"++ qstyle = Style([+ ("qmark", "fg:#d4874a bold"),+ ("question", "bold"),+ ("answer", "fg:#4ade80"),+ ("pointer", "fg:#d4874a bold"),+ ("highlighted", "fg:#d4874a bold"),+ ("selected", "fg:#4ade80"),+ ("instruction", "fg:#a1a1aa"),+ ])++ presets = list_presets()++ # Action menu+ actions = [questionary.Choice("Create new preset", value="_new")]+ if presets:+ for p in presets:+ label = p["name"]+ if p.get("video_path"):+ label += f" — {os.path.basename(p['video_path'])}"+ actions.append(questionary.Choice(f"Edit: {label}", value=f"edit:{p['name']}"))+ for p in presets:+ actions.append(questionary.Choice(f"Delete: {p['name']}", value=f"del:{p['name']}"))+ actions.append(questionary.Choice("← Back", value="_back"))++ action = questionary.select("Presets:", choices=actions, style=qstyle).ask()+ if action is None or action == "_back":return- if not name:++ if action.startswith("del:"):+ name = action[4:]+ if questionary.confirm(f"Delete preset '{name}'?", default=False, style=qstyle).ask():+ delete_preset(name)+ print(f" {green}✓{reset} Deleted '{name}'\n")return- # Get path- sys.stdout.write(f" Path: ")- sys.stdout.flush()+ # Create or edit+ if action == "_new":+ name = questionary.text("Preset name:", style=qstyle).ask()+ if not name:+ return+ existing = {}+ else:+ name = action[5:] # strip "edit:"+ try:+ existing = get_preset(name)+ existing.pop("name", None)+ except FileNotFoundError:+ existing = {}++ config = {**existing}++ # Video path+ video = questionary.path(+ "Video path (Enter to skip):",+ default=config.get("video_path") or "",+ style=qstyle,+ ).ask()+ if video is None:+ return+ if video:+ config["video_path"] = _clean_path(video)++ # Caption style+ caption_style = questionary.select(+ "Caption style:",+ choices=["branded", "hormozi", "karaoke", "subtle"],+ default=config.get("caption_style", "branded"),+ style=qstyle,+ ).ask()+ if caption_style:+ config["caption_style"] = caption_style++ # Crop strategy+ crop = questionary.select(+ "Crop strategy:",+ choices=["face", "center"],+ default=config.get("crop_strategy", "face"),+ style=qstyle,+ ).ask()+ if crop:+ config["crop_strategy"] = crop++ # Logo from assetstry:- path = sys.stdin.readline().strip().strip("'\"")- except (EOFError, KeyboardInterrupt):+ from services.asset_store import list_assets+ logos = [a for a in list_assets() if a["type"] == "logo" and os.path.exists(a["path"])]+ if logos:+ logo_choices = [questionary.Choice(f"{a['name']} ({os.path.basename(a['path'])})", value=a["path"]) for a in logos]+ logo_choices.append(questionary.Choice("None", value=""))+ current_logo = config.get("logo_path", "")+ logo = questionary.select("Logo:", choices=logo_choices, default=current_logo or logo_choices[0], style=qstyle).ask()+ if logo is not None:+ config["logo_path"] = logo+ except Exception:+ pass++ # Outro from assets+ try:+ from services.asset_store import list_assets as list_assets_o+ outros = [a for a in list_assets_o() if a["type"] == "video" and os.path.exists(a["path"])]+ if outros:+ outro_choices = [questionary.Choice("None", value="")]+ outro_choices += [questionary.Choice(f"{a['name']} ({os.path.basename(a['path'])})", value=a["path"]) for a in outros]+ current_outro = config.get("outro_path", "")+ outro = questionary.select("Outro:", choices=outro_choices, default=current_outro or outro_choices[0], style=qstyle).ask()+ if outro is not None:+ config["outro_path"] = outro+ except Exception:+ pass++ # Quality+ quality = questionary.select(+ "Quality:",+ choices=["low", "medium", "high", "max"],+ default=config.get("quality", "max"),+ style=qstyle,+ ).ask()+ if quality:+ config["quality"] = quality++ # Top clips+ top = questionary.text(+ "Top clips:",+ default=str(config.get("top_clips", 5)),+ style=qstyle,+ validate=lambda v: True if v.isdigit() and int(v) > 0 else "Enter a number",+ ).ask()+ if top:+ config["top_clips"] = int(top)++ # Corrections+ if questionary.confirm("Include current word corrections?", default=bool(config.get("corrections")), style=qstyle).ask():+ from services.corrections import get_corrections+ config["corrections"] = get_corrections()++ save_preset(name, config)+ print(f"\n {green}✓{reset} Preset '{accent}{name}{reset}' saved\n")+++def _interactive_corrections():+ """Interactive corrections management using questionary."""+ import questionary+ from questionary import Style+ from services.corrections import get_corrections, save_corrections++ green = "\033[38;2;74;222;128m"+ gray = "\033[38;5;245m"+ reset = "\033[0m"++ qstyle = Style([+ ("qmark", "fg:#d4874a bold"),+ ("question", "bold"),+ ("answer", "fg:#4ade80"),+ ("pointer", "fg:#d4874a bold"),+ ("highlighted", "fg:#d4874a bold"),+ ("selected", "fg:#4ade80"),+ ("instruction", "fg:#a1a1aa"),+ ])++ corrections = get_corrections()+ if corrections:+ print(f"\n Word corrections ({len(corrections)}):")+ for wrong, correct in sorted(corrections.items()):+ print(f" {gray}{wrong}{reset} → {green}{correct}{reset}")print()++ actions = [questionary.Choice("Add a correction", value="add")]+ if corrections:+ actions.append(questionary.Choice("Remove a correction", value="remove"))+ actions.append(questionary.Choice("← Back", value="_back"))++ action = questionary.select("Corrections:", choices=actions, style=qstyle).ask()+ if action is None or action == "_back":return- if not path:- print(f" {gray}Cancelled.{reset}\n")++ if action == "add":+ wrong = questionary.text("Wrong word (what Whisper hears):", style=qstyle).ask()+ if not wrong:+ return+ correct = questionary.text("Correct word:", style=qstyle).ask()+ if not correct:+ return+ corrections[wrong] = correct+ save_corrections(corrections)+ print(f"\n {green}✓{reset} Added: {gray}{wrong}{reset} → {green}{correct}{reset}")+ print(f" {gray}({len(corrections)} total corrections){reset}\n")++ elif action == "remove":+ choices = [questionary.Choice(f"{w} → {c}", value=w) for w, c in sorted(corrections.items())]+ to_remove = questionary.select("Remove which?", choices=choices, style=qstyle).ask()+ if to_remove:+ del corrections[to_remove]+ save_corrections(corrections)+ print(f"\n {green}✓{reset} Removed: {gray}{to_remove}{reset}\n")+++def _interactive_thumbnails():+ """Interactive thumbnail generation using questionary."""+ import questionary+ from questionary import Style++ qstyle = Style([+ ("qmark", "fg:#d4874a bold"),+ ("question", "bold"),+ ("answer", "fg:#4ade80"),+ ("pointer", "fg:#d4874a bold"),+ ("highlighted", "fg:#d4874a bold"),+ ("selected", "fg:#4ade80"),+ ("instruction", "fg:#a1a1aa"),+ ])++ title = questionary.text("Title text:", style=qstyle).ask()+ if not title:return- path = _clean_path(path)- try:- asset = register(name, path)- print(f"\n {green}✓{reset} Registered {accent}{name}{reset} ({asset['type']})")- print(f" {gray}{asset['path']}{reset}\n")- except FileNotFoundError as e:- print(f"\n {red}✗{reset} {e}\n", file=sys.stderr)+ video = questionary.path(+ "Video path (Enter to skip):",+ default="",+ style=qstyle,+ ).ask()+ if video:+ video = _clean_path(video)++ args_ns = _Namespace(+ title=title,+ video=video or None,+ logo=None,+ variations=3,+ )+ cmd_thumbnails(args_ns)+++def _interactive_info():+ """Show system info."""+ args_ns = _Namespace()+ cmd_info(args_ns)+++class _Namespace:+ """Minimal namespace for interactive commands."""+ def __init__(self, **kwargs):+ for k, v in kwargs.items():+ setattr(self, k, v)++ def __getattr__(self, name):+ return Noneif __name__ == "__main__":diff --git a/backend/main.py b/backend/main.pyindex eec9044..ce13175 100644--- a/backend/main.py+++ b/backend/main.py@@ -50,6 +50,7 @@ def handle_ping(task_id: str, params: dict):def handle_transcribe(task_id: str, params: dict):"""Transcribe a podcast video/audio file with speaker detection."""from services.transcription import transcribe_file+ from services.corrections import apply_correctionsemit_progress(task_id, "transcribing", 0, "Starting transcription...")result = transcribe_file(@@ -60,6 +61,8 @@ def handle_transcribe(task_id: str, params: dict):num_speakers=params.get("num_speakers"),progress_callback=lambda pct, msg: emit_progress(task_id, "transcribing", pct, msg),)+ # Apply word corrections (Whisper misheard proper nouns)+ apply_corrections(result.get("words", []), result.get("segments", []))emit_result(task_id, "success", data=result)@@ -145,6 +148,7 @@ def handle_batch_clips(task_id: str, params: dict):def handle_parse_transcript(task_id: str, params: dict):"""Parse a speaker-labeled transcript into word-level timestamps."""from services.transcript_parser import detect_and_parse+ from services.corrections import apply_correctionsraw_text = params.get("raw_text", "")total_duration = params.get("total_duration")@@ -161,6 +165,9 @@ def handle_parse_transcript(task_id: str, params: dict):emit_result(task_id, "error", error=result["error"])return+ # Apply word corrections (proper nouns, brand names)+ apply_corrections(result.get("words", []), result.get("segments", []))+emit_progress(task_id, "parsing", 100, "Transcript parsed!")emit_result(task_id, "success", data=result)@@ -216,6 +223,38 @@ def handle_presets(task_id: str, params: dict):emit_result(task_id, "error", error=f"Unknown presets action: {action}")+def handle_corrections(task_id: str, params: dict):+ """Manage transcript word corrections (get, set, add, remove)."""+ from services.corrections import get_corrections, save_corrections++ action = params.get("action", "get")++ if action == "get":+ emit_result(task_id, "success", data={"corrections": get_corrections()})+ elif action == "set":+ corrections = params.get("corrections", {})+ path = save_corrections(corrections)+ emit_result(task_id, "success", data={"corrections": corrections, "path": path})+ elif action == "add":+ wrong = params.get("wrong", "")+ correct = params.get("correct", "")+ if not wrong or not correct:+ emit_result(task_id, "error", error="'wrong' and 'correct' are required")+ return+ current = get_corrections()+ current[wrong] = correct+ save_corrections(current)+ emit_result(task_id, "success", data={"corrections": current})+ elif action == "remove":+ wrong = params.get("wrong", "")+ current = get_corrections()+ current.pop(wrong, None)+ save_corrections(current)+ emit_result(task_id, "success", data={"corrections": current})+ else:+ emit_result(task_id, "error", error=f"Unknown corrections action: {action}")++def handle_suggest_clips(task_id: str, params: dict):"""AI-powered clip suggestion using Claude/Codex and PodStack knowledge base."""from services.claude_suggest import suggest_with_claude@@ -273,6 +312,7 @@ TASK_HANDLERS = {"analyze_energy": handle_analyze_energy,"detect_encoder": handle_detect_encoder,"presets": handle_presets,+ "corrections": handle_corrections,"suggest_clips": handle_suggest_clips,"generate_content": handle_generate_content,}diff --git a/backend/presets.py b/backend/presets.pyindex 38a4d19..ead4fa0 100644--- a/backend/presets.py+++ b/backend/presets.py@@ -3,6 +3,9 @@ Preset/template system for podcli.Save and load named configurations so you don't reconfigure settingsfor every episode. Stored as JSON in .podcli/presets/++A preset is a complete show config: video path, rendering options,+corrections, output dir — everything needed to run `podcli process --preset myshow`."""import os@@ -21,12 +24,19 @@ DEFAULT_PRESET = {"crop_strategy": "face","time_adjust": -1.0,"logo_path": "",+ "outro_path": "",+ "video_path": "",+ "transcript_path": "",+ "output_dir": "","whisper_model": "base","top_clips": 5,"max_clip_duration": 90,"min_clip_duration": 20,"target_lufs": -14.0,"energy_boost": True,+ "quality": "max",+ "no_speakers": False,+ "corrections": {},}@@ -66,15 +76,16 @@ def get_preset(name: str) -> dict:def save_preset(name: str, config: dict) -> str:- """Save a preset to disk."""+ """Save a preset to disk. Saves all provided keys."""os.makedirs(PRESETS_DIR, exist_ok=True)path = os.path.join(PRESETS_DIR, f"{name}.json")- # Only save keys that differ from or match the default schema+ # Save all keys that are provided (not just DEFAULT_PRESET keys)to_save = {}- for key in DEFAULT_PRESET:- if key in config:- to_save[key] = config[key]+ for key, val in config.items():+ if key == "name":+ continue # don't store the name inside the file+ to_save[key] = valwith open(path, "w") as f:json.dump(to_save, f, indent=2)diff --git a/backend/requirements.txt b/backend/requirements.txtindex 28ff7df..5b6744b 100644--- a/backend/requirements.txt+++ b/backend/requirements.txt@@ -15,5 +15,8 @@ numpy>=1.24.0# ThumbnailsPillow>=10.0.0+# CLI interactive prompts+questionary>=2.0.0+# Utilitiespython-dotenv>=1.0.0diff --git a/backend/services/corrections.py b/backend/services/corrections.pynew file mode 100644index 0000000..2046dfd--- /dev/null+++ b/backend/services/corrections.py@@ -0,0 +1,113 @@+"""+Transcript word corrections — fixes Whisper misheard proper nouns.++Loads replacements from .podcli/corrections.json and applies them to+transcript words and segments. Single source of truth used by all paths+(Whisper, import, parse).++Format of corrections.json:+{+ "Boxel": "Voxel",+ "grub": "GRU",+ "open AI": "OpenAI"+}+"""++import json+import os+import re+from typing import Optional+++_CORRECTIONS_PATH = os.path.join(+ os.path.dirname(os.path.abspath(__file__)), "..", "..", ".podcli", "corrections.json"+)+++def _load_corrections() -> dict[str, str]:+ """Load corrections dict from .podcli/corrections.json."""+ if not os.path.exists(_CORRECTIONS_PATH):+ return {}+ try:+ with open(_CORRECTIONS_PATH) as f:+ data = json.load(f)+ if isinstance(data, dict):+ return data+ return {}+ except Exception:+ return {}+++def get_corrections() -> dict[str, str]:+ """Get current corrections dict (public API for UI/MCP)."""+ return _load_corrections()+++def save_corrections(corrections: dict[str, str]) -> str:+ """Save corrections dict to .podcli/corrections.json. Returns the file path."""+ os.makedirs(os.path.dirname(_CORRECTIONS_PATH), exist_ok=True)+ with open(_CORRECTIONS_PATH, "w") as f:+ json.dump(corrections, f, indent=2, ensure_ascii=False)+ return _CORRECTIONS_PATH+++def _build_pattern(corrections: dict[str, str]) -> Optional[re.Pattern]:+ """Build a compiled regex that matches any correction key (case-insensitive, word boundary)."""+ if not corrections:+ return None+ # Sort by length descending so longer matches take priority (e.g. "open AI" before "AI")+ keys = sorted(corrections.keys(), key=len, reverse=True)+ pattern = "|".join(re.escape(k) for k in keys)+ return re.compile(rf"\b({pattern})\b", re.IGNORECASE)+++def _replace_match(match: re.Match, corrections: dict[str, str]) -> str:+ """Replace a regex match with its correction, preserving the original's case pattern."""+ matched = match.group(0)+ # Look up case-insensitive: try exact first, then case-insensitive scan+ replacement = corrections.get(matched)+ if replacement is None:+ for key, val in corrections.items():+ if key.lower() == matched.lower():+ replacement = val+ break+ return replacement if replacement is not None else matched+++def apply_corrections(+ words: list[dict],+ segments: list[dict],+) -> tuple[list[dict], list[dict]]:+ """+ Apply corrections to transcript words and segments in-place.++ Modifies the 'word' field in each word dict and the 'text' field+ in each segment dict. Returns the same lists (mutated).+ """+ corrections = _load_corrections()+ if not corrections:+ return words, segments++ pattern = _build_pattern(corrections)+ if pattern is None:+ return words, segments++ replacer = lambda m: _replace_match(m, corrections)++ # Fix individual words+ for w in words:+ word_text = w.get("word", "")+ if word_text:+ new_text = pattern.sub(replacer, word_text)+ if new_text != word_text:+ w["word"] = new_text++ # Fix segment text (may contain multi-word corrections like "open AI" → "OpenAI")+ for seg in segments:+ seg_text = seg.get("text", "")+ if seg_text:+ new_text = pattern.sub(replacer, seg_text)+ if new_text != seg_text:+ seg["text"] = new_text++ return words, segmentsdiff --git a/src/models/index.ts b/src/models/index.tsindex bc5e8f2..2fc7953 100644--- a/src/models/index.ts+++ b/src/models/index.ts@@ -2,7 +2,7 @@export interface TaskRequest {task_id: string;- task_type: "transcribe" | "parse_transcript" | "create_clip" | "batch_clips" | "analyze_energy" | "detect_encoder" | "presets" | "ping" | "suggest_clips" | "generate_content";+ task_type: "transcribe" | "parse_transcript" | "create_clip" | "batch_clips" | "analyze_energy" | "detect_encoder" | "presets" | "ping" | "suggest_clips" | "generate_content" | "corrections";params: Record<string, unknown>;}diff --git a/src/ui/public/index.html b/src/ui/public/index.htmlindex 11aaca1..dba1a79 100644--- a/src/ui/public/index.html+++ b/src/ui/public/index.html@@ -242,9 +242,14 @@const [encoderInfo, setEncoderInfo] = useState(null);const [speakerStatus, setSpeakerStatus] = useState(null);const [generateCopied, setGenerateCopied] = useState(false);+ const [corrections, setCorrections] = useState({});+ const [correctionWord, setCorrectionWord] = useState('');+ const [correctionFix, setCorrectionFix] = useState('');+ const [correctionsOpen, setCorrectionsOpen] = useState(false);useEffect(() => {api('/encoder-info').then(d => { if (d.best) setEncoderInfo(d); }).catch(() => { });api('/speaker-status').then(d => setSpeakerStatus(d)).catch(() => { });+ api('/corrections').then(d => { if (d && typeof d === 'object') setCorrections(d); }).catch(() => { });}, []);// Fetch clip history on mount and after exports@@ -780,6 +785,54 @@</div></div>+ {/* Word Corrections */}+ <div className="section">+ <div className="section-label" style={{ cursor: 'pointer', display: 'flex', alignItems: 'center', gap: 6 }} onClick={() => setCorrectionsOpen(!correctionsOpen)}>+ <span style={{ fontSize: 10, transition: 'transform 0.15s', transform: correctionsOpen ? 'rotate(90deg)' : 'rotate(0deg)', display: 'inline-block' }}>▶</span>+ Word Corrections+ {Object.keys(corrections).length > 0 && (+ <span style={{ fontSize: 10, color: 'var(--text3)', fontWeight: 400 }}>({Object.keys(corrections).length})</span>+ )}+ </div>+ {correctionsOpen && (+ <div className="fade-in" style={{ marginTop: 8 }}>+ <div style={{ fontSize: 11, color: 'var(--text3)', marginBottom: 8, lineHeight: 1.4 }}>+ Fix Whisper misheard words. Applied automatically to all transcripts.+ </div>+ <div style={{ display: 'flex', gap: 6, marginBottom: 8 }}>+ <input value={correctionWord} onChange={e => setCorrectionWord(e.target.value)}+ placeholder="Wrong (e.g. Boxel)" style={{ flex: 1, fontSize: 12 }} />+ <span style={{ color: 'var(--text3)', alignSelf: 'center', fontSize: 12 }}>→</span>+ <input value={correctionFix} onChange={e => setCorrectionFix(e.target.value)}+ placeholder="Correct (e.g. Voxel)" style={{ flex: 1, fontSize: 12 }}+ onKeyDown={e => { if (e.key === 'Enter' && correctionWord.trim() && correctionFix.trim()) {+ api('/corrections/add', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ wrong: correctionWord.trim(), correct: correctionFix.trim() }) })+ .then(d => { if (d.corrections) { setCorrections(d.corrections); setCorrectionWord(''); setCorrectionFix(''); } });+ }}} />+ <button className="btn btn-sm" disabled={!correctionWord.trim() || !correctionFix.trim()} onClick={() => {+ api('/corrections/add', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ wrong: correctionWord.trim(), correct: correctionFix.trim() }) })+ .then(d => { if (d.corrections) { setCorrections(d.corrections); setCorrectionWord(''); setCorrectionFix(''); } });+ }} style={{ fontSize: 11, padding: '4px 10px' }}>Add</button>+ </div>+ {Object.keys(corrections).length > 0 && (+ <div style={{ display: 'flex', flexWrap: 'wrap', gap: 4 }}>+ {Object.entries(corrections).map(([wrong, correct]) => (+ <div key={wrong} className="asset-pill" style={{ fontSize: 11 }}>+ <span style={{ color: 'var(--text3)', textDecoration: 'line-through' }}>{wrong}</span>+ <span style={{ color: 'var(--text3)', margin: '0 2px' }}>→</span>+ <span style={{ color: 'var(--green)' }}>{correct}</span>+ <button className="asset-pill-x" onClick={() => {+ fetch(`/api/corrections/${encodeURIComponent(wrong)}`, { method: 'DELETE' })+ .then(r => r.json()).then(d => { if (d.corrections) setCorrections(d.corrections); });+ }}>{'\u00D7'}</button>+ </div>+ ))}+ </div>+ )}+ </div>+ )}+ </div>+{/* Error */}{error && (<div className="error-bar fade-in">diff --git a/src/ui/web-server.ts b/src/ui/web-server.tsindex 605d9f5..6c32a07 100644--- a/src/ui/web-server.ts+++ b/src/ui/web-server.ts@@ -1007,6 +1007,65 @@ app.get("/api/history/check", async (req, res) => {}});+// --- Transcript Corrections ---++const correctionsPath = join(process.cwd(), ".podcli", "corrections.json");++app.get("/api/corrections", (_req, res) => {+ try {+ if (existsSync(correctionsPath)) {+ res.json(JSON.parse(readFileSync(correctionsPath, "utf-8")));+ } else {+ res.json({});+ }+ } catch {+ res.json({});+ }+});++app.put("/api/corrections", express.json(), (req, res) => {+ try {+ const corrections = req.body || {};+ writeFileSync(correctionsPath, JSON.stringify(corrections, null, 2));+ res.json({ ok: true, corrections });+ } catch (err: any) {+ res.status(500).json({ error: err.message });+ }+});++app.post("/api/corrections/add", express.json(), (req, res) => {+ const { wrong, correct } = req.body;+ if (!wrong || !correct) {+ res.status(400).json({ error: "'wrong' and 'correct' are required" });+ return;+ }+ try {+ let corrections: Record<string, string> = {};+ if (existsSync(correctionsPath)) {+ corrections = JSON.parse(readFileSync(correctionsPath, "utf-8"));+ }+ corrections[wrong] = correct;+ writeFileSync(correctionsPath, JSON.stringify(corrections, null, 2));+ res.json({ ok: true, corrections });+ } catch (err: any) {+ res.status(500).json({ error: err.message });+ }+});++app.delete("/api/corrections/:wrong", (req, res) => {+ try {+ let corrections: Record<string, string> = {};+ if (existsSync(correctionsPath)) {+ corrections = JSON.parse(readFileSync(correctionsPath, "utf-8"));+ }+ delete corrections[req.params.wrong];+ writeFileSync(correctionsPath, JSON.stringify(corrections, null, 2));+ res.json({ ok: true, corrections });+ } catch (err: any) {+ res.status(500).json({ error: err.message });+ }+});+// --- Knowledge Base ---app.get("/api/knowledge", async (_req, res) => {try {