-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
49 lines (40 loc) · 1.71 KB
/
main.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
from database import init_db, get_user_info, save_user_info
from versus_screen_analysis import detect_loading_screen
from replay_watcher import watch_replay_folder
import time
import os
def get_user_input():
username, replay_path = get_user_info()
if not username:
while True:
username = input("Please enter your StarCraft II username: ").strip()
if username:
break
print("Username cannot be empty. Please try again.")
if not replay_path or not os.path.exists(replay_path):
while True:
replay_path = input("Please enter the full path to your StarCraft II replay folder: ").strip()
if os.path.exists(replay_path):
break
print("Invalid path. Please make sure the folder exists.")
save_user_info(username, replay_path)
return username, replay_path
def main():
# Initialize the database
init_db()
# Get or prompt for username and replay path
username, replay_folder_path = get_user_input()
print(f"Welcome, {username}!")
print(f"Using replay folder: {replay_folder_path}")
while True:
if detect_loading_screen(username):
print("Watching replay folder for new replays...")
while True:
new_replay_detected = watch_replay_folder(replay_folder_path, username)
if new_replay_detected:
print("New replay detected and analyzed. Restarting loading screen monitoring...")
break
time.sleep(10) # Check for new replays every 10 seconds
time.sleep(0.5) # Small delay before checking loading screen again
if __name__ == "__main__":
main()