Create run.py
Browse files
run.py
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import subprocess
|
2 |
+
|
3 |
+
# Ask how many times to run the script
|
4 |
+
num_runs = int(input("Enter number of times to run the script: "))
|
5 |
+
|
6 |
+
for i in range(num_runs):
|
7 |
+
# Run step1.py and print status
|
8 |
+
print(f"Running step1 Generating Story for run {i+1}...")
|
9 |
+
result = subprocess.run(["python3", "step1.py"])
|
10 |
+
if result.returncode == 0:
|
11 |
+
print("Step 1 complete.")
|
12 |
+
else:
|
13 |
+
print("Step 1 failed.")
|
14 |
+
continue
|
15 |
+
|
16 |
+
# Run step2.py and print status
|
17 |
+
print(f"Running step2 Generating Audio for run {i+1}...")
|
18 |
+
result = subprocess.run(["python3", "step2.py"])
|
19 |
+
if result.returncode == 0:
|
20 |
+
print("Step 2 complete.")
|
21 |
+
else:
|
22 |
+
print("Step 2 failed.")
|
23 |
+
continue
|
24 |
+
|
25 |
+
# Run step3.py and print status
|
26 |
+
print(f"Running step3 Generating Images for run {i+1}...")
|
27 |
+
while True:
|
28 |
+
result = subprocess.run(["python3", "step3.py"])
|
29 |
+
if result.returncode == 0:
|
30 |
+
print("Step 3 complete.")
|
31 |
+
break
|
32 |
+
elif result.returncode == 1:
|
33 |
+
print("Error in step3.py. Starting over from step1.py...")
|
34 |
+
break
|
35 |
+
else:
|
36 |
+
print("Step 3 failed. Trying again...")
|
37 |
+
continue
|
38 |
+
|
39 |
+
# Run step4.py and print status
|
40 |
+
print(f"Running step4 Generating Video for run {i+1}...")
|
41 |
+
result = subprocess.run(["python3", "step4.py"])
|
42 |
+
if result.returncode == 0:
|
43 |
+
print("Step 4 complete.")
|
44 |
+
else:
|
45 |
+
print("Step 4 failed.")
|
46 |
+
continue
|
47 |
+
|
48 |
+
# Run step5.py and print status
|
49 |
+
print(f"Running step5 Cleaning up and archiving temporary files {i+1}...")
|
50 |
+
result = subprocess.run(["python3", "step5.py"])
|
51 |
+
if result.returncode == 0:
|
52 |
+
print("Step 5 complete.")
|
53 |
+
else:
|
54 |
+
print("Step 5 complete-ish.")
|
55 |
+
continue
|
56 |
+
|
57 |
+
#TODO step6 wrestle stupid youtube oauth or upload straight to tiktok or instagram, which may be an even worse nightmare.
|
58 |
+
|
59 |
+
print("All runs complete.")
|