-
Notifications
You must be signed in to change notification settings - Fork 19
/
Start_AI_Pilot.py
68 lines (58 loc) · 2.75 KB
/
Start_AI_Pilot.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
repo = 'https://github.com/darkmatter2222/EVE-Online-Bot'
# baseline startup
import argparse
import sys
import os
# logging w/o a log directory until sup app determines
from loguru import logger
this_file_path = os.path.abspath(__file__)
logger.info(f"Adding: {this_file_path} to path")
sys.path.append(os.path.dirname(this_file_path))
logger.info(sys.path)
# AI Pilot Atrium Imports
from AI_Pilot.Objectives.Mining.StartMining import start_mining
from AI_Pilot.Objectives.Project_Discovery.AutoRanger import auto_range
from AI_Pilot.Setup.Display_Overlay import display_overlay
from AI_Pilot.UI.Main_UI import AI_Pilot
# parse arguments
parser = argparse.ArgumentParser(prog='Start_AI_Pilot.py')
parser.add_argument("--config_file", metavar="config_file", type=str)
parser.add_argument("--headless_miner", metavar="headless_miner", type=str)
parser.add_argument("--headless_project_discovery", metavar="headless_project_discovery", type=str)
parser.add_argument("--setup_mode", metavar="setup_mode", type=str)
params = parser.parse_args()
if params.config_file is None:
exception_message = f"Expecting valid '--config_file' path to be passed as an argument."
exception_message += " The key '--config_file' was not found to be passed."
exception_message += f" Visit '{repo}' for instructions."
logger.exception(exception_message)
raise Exception(exception_message)
elif not os.path.isfile(params.config_file):
exception_message = f"Expecting valid '--config_file' path to be passed as an argument."
exception_message += f" No file exists at:'{params.config_file}'."
exception_message += f" Visit '{repo}' for instructions."
logger.exception(exception_message)
raise Exception(exception_message)
params.headless_miner = False if params.headless_miner is None else bool(eval(params.headless_miner))
params.headless_project_discovery = False if params.headless_project_discovery is None else bool(eval(params.headless_project_discovery))
params.setup_mode = False if params.setup_mode is None else bool(eval(params.setup_mode))
objectives = [
params.headless_miner,
params.headless_project_discovery,
params.setup_mode
]
if sum(bool(x) for x in objectives) != 1:
exception_message = f"More or less than one objective selected."
exception_message += f" Please choose only one objective: [headless_miner, headless_project_discovery, setup_mode]"
exception_message += f" Visit '{repo}' for instructions."
logger.exception(exception_message)
raise Exception(exception_message)
if params.headless_miner:
start_mining(params.config_file)
elif params.headless_project_discovery:
auto_range(params.config_file)
elif params.setup_mode:
display_overlay(params.config_file)
else:
aip = AI_Pilot(params.config_file)
aip.start()