-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
51 lines (37 loc) · 1.03 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
50
51
# MaaFw 启动入口
from pathlib import Path
from maa.resource import Resource
from maa.controller import AdbController
from maa.tasker import Tasker
from maa.toolkit import Toolkit
from utils.tool import Find, Connect
# 获取脚本运行路径
main_path = Path.cwd()
def main(
tasks: list[dict] = {},
res_paths: list[Path] = "",
connect_kind: str = "Adb",
connect_config: dict = {},
):
# 处理跨平台路径问题
user_path = Path(f"{main_path}/cache")
res_path = Path(res_path)
adb_path = Path(adb_path)
# Toolkit 初始化
Toolkit.init_option(user_path)
# 加载资源
resource = Resource()
resource.post_path(res_path).wait()
# Controller 初始化
# TODO
# Tasker 初始化
tasker = Tasker()
tasker.bind(resource, controller)
if not tasker.inited:
print("Failed to init.")
exit()
# 执行任务
for task in tasks:
tasker.post_pipeline(task["entry"], task["pipeline_override"]).wait().get()
if __name__ == "__main__":
main()