|
import subprocess |
|
|
|
|
|
num_runs = int(input("Enter number of times to run the script: ")) |
|
|
|
for i in range(num_runs): |
|
|
|
print(f"Running step1 Generating Story for run {i+1}...") |
|
result = subprocess.run(["python3", "step1.py"]) |
|
if result.returncode == 0: |
|
print("Step 1 complete.") |
|
else: |
|
print("Step 1 failed.") |
|
continue |
|
|
|
|
|
print(f"Running step2 Generating Audio for run {i+1}...") |
|
result = subprocess.run(["python3", "step2.py"]) |
|
if result.returncode == 0: |
|
print("Step 2 complete.") |
|
else: |
|
print("Step 2 failed.") |
|
continue |
|
|
|
|
|
print(f"Running step3 Generating Images for run {i+1}...") |
|
while True: |
|
result = subprocess.run(["python3", "step3.py"]) |
|
if result.returncode == 0: |
|
print("Step 3 complete.") |
|
break |
|
elif result.returncode == 1: |
|
print("Error in step3.py. Starting over from step1.py...") |
|
break |
|
else: |
|
print("Step 3 failed. Trying again...") |
|
continue |
|
|
|
|
|
print(f"Running step4 Generating Video for run {i+1}...") |
|
result = subprocess.run(["python3", "step4.py"]) |
|
if result.returncode == 0: |
|
print("Step 4 complete.") |
|
else: |
|
print("Step 4 failed.") |
|
continue |
|
|
|
|
|
print(f"Running step5 Cleaning up and archiving temporary files {i+1}...") |
|
result = subprocess.run(["python3", "step5.py"]) |
|
if result.returncode == 0: |
|
print("Step 5 complete.") |
|
else: |
|
print("Step 5 complete-ish.") |
|
continue |
|
|
|
|
|
|
|
print("All runs complete.") |