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: wire /auto into interactive menu + fix slow startup
Nika Siradzeb5442f8d0275
diff --git a/backend/cli.py b/backend/cli.pyindex 746e8ed..d676eb0 100644--- a/backend/cli.py+++ b/backend/cli.py@@ -2684,6 +2684,7 @@ def interactive_menu():choice = questionary.select("What do you want to do?",choices=[+ questionary.Choice("/auto → one-verb pipeline (Claude Code)", value="auto"),questionary.Choice("Process a video → shorts", value="process"),questionary.Choice("Open Web UI", value="webui"),questionary.Separator(),@@ -2704,6 +2705,9 @@ def interactive_menu():if choice is None or choice == "quit":return+ elif choice == "auto":+ _interactive_auto()+ returnelif choice == "process":_interactive_process()return@@ -2775,6 +2779,123 @@ def _ask(prompt, default=None, validate=None, required=False, is_path=False):return val+def _interactive_auto():+ """Pick a video (preset or new), then launch Claude Code with /auto <path>."""+ import questionary+ from questionary import Style++ accent = "\033[38;2;212;135;74m"+ green = "\033[38;2;74;222;128m"+ gray = "\033[38;5;245m"+ dim = "\033[2m"+ bold = "\033[1m"+ 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"),+ ])++ from presets import list_presets, get_preset+ presets = list_presets()+ preset_choices = [p for p in presets if p.get("video_path")]++ video_path = None+ preset_name = None++ if preset_choices:+ options = [+ questionary.Choice(+ f"{p['name']} — {os.path.basename(p['video_path'])}",+ value=p["name"],+ )+ for p in preset_choices+ ]+ options.append(questionary.Separator())+ options.append(questionary.Choice("New video (paste path)", value="_new"))+ options.append(questionary.Choice("Back", value="_back"))++ pick = questionary.select(+ "Which video should /auto work on?",+ choices=options,+ style=qstyle,+ ).ask()+ if pick is None or pick == "_back":+ return++ if pick != "_new":+ config = get_preset(pick)+ video_path = config.get("video_path")+ preset_name = pick+ if not video_path or not os.path.exists(video_path):+ print(f"\n {bold}Video not found:{reset} {video_path}\n")+ return++ if not video_path:+ val = questionary.path(+ "Video file:",+ style=qstyle,+ validate=lambda v: True if os.path.exists(_clean_path(v)) else "File not found",+ ).ask()+ if not val:+ return+ video_path = _clean_path(val)++ brief = questionary.text(+ "Brief (optional — e.g. '5 clips' or 'focus on investor pitch'):",+ style=qstyle,+ default="",+ ).ask()+ if brief is None:+ return++ # Build the prompt. Preset settings (caption style, crop, logo, outro) flow+ # as context so /auto can honor them without a preset-aware tool schema change.+ prompt_parts = [f"/auto {video_path}"]+ if preset_name:+ config = get_preset(preset_name)+ hints = []+ if config.get("caption_style"):+ hints.append(f"caption: {config['caption_style']}")+ if config.get("crop_strategy"):+ hints.append(f"crop: {config['crop_strategy']}")+ if config.get("logo"):+ hints.append(f"logo: {config['logo']}")+ if config.get("outro"):+ hints.append(f"outro: {config['outro']}")+ tag = f"preset '{preset_name}'"+ if hints:+ tag += f" ({', '.join(hints)})"+ prompt_parts.append(f"— {tag}")+ if brief.strip():+ prompt_parts.append(f"— {brief.strip()}")+ prompt = " ".join(prompt_parts)++ import shutil+ claude_bin = shutil.which("claude")+ if not claude_bin:+ print()+ print(f" {bold}Claude Code not found in PATH.{reset}")+ print(f" {dim}Install it, then run:{reset}")+ print(f" {accent}claude \"{prompt}\"{reset}")+ print()+ return++ project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))+ print()+ print(f" {green}▶{reset} Launching Claude Code with: {accent}{prompt}{reset}")+ print(f" {dim}cwd: {project_root}{reset}")+ print()+ sys.stdout.flush()+ import subprocess as _sp+ sys.exit(_sp.call([claude_bin, prompt], cwd=project_root))++def _interactive_process():"""Interactive video processing wizard using questionary."""import questionarydiff --git a/backend/services/claude_suggest.py b/backend/services/claude_suggest.pyindex 5e0802d..b781083 100644--- a/backend/services/claude_suggest.py+++ b/backend/services/claude_suggest.py@@ -20,18 +20,15 @@ from presets import MIN_CLIP_DURATION, MAX_CLIP_DURATION, TARGET_CLIP_DURATION_Mdef _find_cli(name: str, extra_paths: list[str] = None) -> Optional[str]:- """Find a CLI binary by name. Checks extra_paths first, then PATH."""+ """Find a CLI binary by name. Checks extra_paths first, then PATH.+ Uses shutil.which (pure Python) to avoid the ~50-100ms cost of spawning+ a `which` subprocess — banner renders twice (claude + codex) on startup.+ """+ import shutilfor path in (extra_paths or []):if os.path.exists(path):return path- try:- from utils.proc import run as proc_run- result = proc_run(["which", name], timeout=5, check=False)- if result.returncode == 0 and result.stdout.strip():- return result.stdout.strip()- except Exception:- pass- return None+ return shutil.which(name)def _find_ai_cli_candidates() -> list[tuple[str, str]]:diff --git a/backend/services/encoder.py b/backend/services/encoder.pyindex 673c340..915b2de 100644--- a/backend/services/encoder.py+++ b/backend/services/encoder.py@@ -150,11 +150,54 @@ def get_video_encode_flags() -> list[str]:return ["-c:v", "libx264", "-crf", "18", "-preset", "slow", "-profile:v", "high"]+def _encoder_cache_path() -> str:+ return os.path.join(+ os.path.dirname(os.path.abspath(__file__)),+ "..", "..", ".podcli", "cache", "encoder.json",+ )+++def _ffmpeg_fingerprint() -> str:+ """Cheap fingerprint (path + mtime) to invalidate cache when ffmpeg changes."""+ import shutil+ ffbin = shutil.which("ffmpeg") or "ffmpeg"+ try:+ st = os.stat(ffbin)+ return f"{ffbin}:{int(st.st_mtime)}:{st.st_size}"+ except OSError:+ return ffbin++def get_encoder_info() -> dict:- """Get full encoder detection info (for UI/logging)."""+ """Get full encoder detection info (for UI/logging).++ Cached at .podcli/cache/encoder.json keyed by ffmpeg binary fingerprint.+ Encoder probing runs ffmpeg twice (~1.6s on macOS) — huge startup win.+ """+ import json+ cache_path = _encoder_cache_path()+ fp = _ffmpeg_fingerprint()++ try:+ with open(cache_path) as f:+ cached = json.load(f)+ if cached.get("fingerprint") == fp and cached.get("system") == platform.system():+ return cached["info"]+ except (OSError, ValueError, KeyError):+ pass+try:- return detect_encoders()+ info = detect_encoders()except Exception:- return {"available": ["libx264"], "best": "libx264",+ info = {"available": ["libx264"], "best": "libx264","best_flags": ["-c:v", "libx264", "-crf", "18", "-preset", "slow", "-profile:v", "high"],"system": platform.system()}++ try:+ os.makedirs(os.path.dirname(cache_path), exist_ok=True)+ with open(cache_path, "w") as f:+ json.dump({"fingerprint": fp, "system": platform.system(), "info": info}, f)+ except OSError:+ pass++ return info