diff --git a/run_video_pipeline.py b/run_video_pipeline.py index 1a14bcc..97c9b22 100644 --- a/run_video_pipeline.py +++ b/run_video_pipeline.py @@ -47,10 +47,12 @@ def parse_args() -> argparse.Namespace: return parser.parse_args() -def run_step(name: str, cmd: list[str]) -> None: +def run_step(name: str, cmd: list[str], cwd: Path | None = None) -> None: LOGGER.info("=== %s ===", name) LOGGER.info("$ %s", " ".join(str(part) for part in cmd)) - subprocess.run(cmd, check=True) + if cwd is not None: + LOGGER.info("(cwd: %s)", cwd) + subprocess.run(cmd, check=True, cwd=str(cwd) if cwd else None) def maybe_upload_to_s3(output_path: Path) -> None: @@ -95,6 +97,19 @@ def main() -> int: args.output = args.base_dir / "results" / "final_output.mp4" try: + if not args.skip_generate and not args.reel_script.exists(): + run_step( + "Generate Reel Script", + [ + sys.executable, + str(SCRIPT_DIR / "generate_script.py"), + ], + cwd=args.base_dir, + ) + if not args.reel_script.exists(): + LOGGER.error("Reel script was not generated at %s", args.reel_script) + return 1 + if not args.skip_generate: run_step( "Generate Videos",