#!/usr/bin/env python3 """ Auto Clip - single CLI wrapper Purpose: - Provide one stable entrypoint for the repo - Route commands to V_1 / V_2 / V_3 scripts - Keep it simple and Git-friendly (no packaging required) Usage: python autoclip.py v3 --tracks-dir ./tracks --select all --teaser 60 --bars 2 --harmonic python autoclip.py v2 --tracks-dir ./tracks --select auto --auto-n 8 --teaser 75 --bars 4 python autoclip.py list Notes: - This wrapper assumes your repo structure: V_1/... V_2/dj_teaser_v2.py V_3/dj_teaser_v3.py - It forwards all remaining arguments to the selected version script. """ import argparse import subprocess import sys from pathlib import Path def repo_root() -> Path: return Path(__file__).resolve().parent def existing_script(version: str) -> Path: root = repo_root() v = version.lower() # Adjust these filenames if your scripts differ. candidates = { "v1": [root / "V_1" / "dj_teaser_v1.py", root / "V_1" / "dj_teaser.py"], "v2": [root / "V_2" / "dj_teaser_v2.py", root / "V_2" / "dj_teaser.py"], "v3": [root / "V_3" / "dj_teaser_v3.py", root / "V_3" / "dj_teaser.py"], } if v not in candidates: raise SystemExit(f"Unknown version '{version}'. Use: v1 | v2 | v3") for p in candidates[v]: if p.exists(): return p raise SystemExit( f"Could not find a script for {version}.\n" f"Looked for:\n- " + "\n- ".join(str(p) for p in candidates[v]) ) def list_versions(): root = repo_root() print("Auto Clip versions available:") for v in ["V_1", "V_2", "V_3"]: p = root / v if p.exists(): print(f" - {v}/") print("\nTip: run `python autoclip.py v3 --help` (forwards to the version script).") def main(): parser = argparse.ArgumentParser( prog="autoclip", description="Auto Clip - single CLI wrapper (routes to V_1 / V_2 / V_3).", ) parser.add_argument("command", nargs="?", default="help", help="v1 | v2 | v3 | list | help") parser.add_argument("args", nargs=argparse.REMAINDER, help="Arguments forwarded to the version script") ns = parser.parse_args() cmd = ns.command.lower() if cmd in {"help", "-h", "--help"}: parser.print_help() print("\nExamples:") print(" python autoclip.py list") print(" python autoclip.py v3 --tracks-dir ./tracks --select all --teaser 60 --bars 2 --harmonic") return if cmd == "list": list_versions() return if cmd in {"v1", "v2", "v3"}: script = existing_script(cmd) full = [sys.executable, str(script)] + ns.args raise SystemExit(subprocess.call(full)) raise SystemExit(f"Unknown command '{ns.command}'. Use: v1 | v2 | v3 | list | help") if __name__ == "__main__": main()