forked from LiveCarta/ContentGeneration
Added generate reel script step
This commit is contained in:
@@ -47,10 +47,12 @@ def parse_args() -> argparse.Namespace:
|
|||||||
return parser.parse_args()
|
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 ===", name)
|
||||||
LOGGER.info("$ %s", " ".join(str(part) for part in cmd))
|
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:
|
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"
|
args.output = args.base_dir / "results" / "final_output.mp4"
|
||||||
|
|
||||||
try:
|
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:
|
if not args.skip_generate:
|
||||||
run_step(
|
run_step(
|
||||||
"Generate Videos",
|
"Generate Videos",
|
||||||
|
|||||||
Reference in New Issue
Block a user