-
Notifications
You must be signed in to change notification settings - Fork 9
/
all.py
71 lines (56 loc) · 1.52 KB
/
all.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import subprocess
import requests
import os
import shutil
import time
import glob
delay = 3
def version():
url = "https://gplayapi.herrerde.xyz/api/apps/com.kiloo.subwaysurf"
response = requests.get(url)
data = response.json()
return data.get("version", "").replace(".", "-")
rm_dir = ["temp"]
scripts = [
["script/setup.py"],
["script/generate_characters.py"],
["script/generate_boards.py"],
["script/playerprofile.py"],
["script/script/userstats"],
["script/collection.py"],
["script/calender.py"],
["script/quests.py"],
["script/update.py"],
["script/convert.py"],
["script/encrypt.py"],
["script/zip.py"],
]
def cleanup():
print(f"Starting cleanup")
try:
for directory in rm_dir:
if os.path.exists(directory):
shutil.rmtree(directory)
print(f"Finished cleanup\n")
except KeyboardInterrupt:
print("Cleanup interrupted by user.")
raise
def run_scripts():
try:
os.makedirs("temp", exist_ok=True)
for script in scripts:
print(f"Running {script[0]}...")
subprocess.run(["python"] + script, check=True)
print(f"Finished running {script[0]}.\n")
time.sleep(delay)
except KeyboardInterrupt:
print("Script execution interrupted by user.")
raise
def main():
try:
cleanup()
run_scripts()
except KeyboardInterrupt:
print("Script terminated by user.")
if __name__ == "__main__":
main()