修复死循环,日志读取优化,运行流程优化

This commit is contained in:
DLmaster
2024-04-03 20:06:48 +08:00
parent 63ed257a5f
commit ebd3273251
8 changed files with 16 additions and 9 deletions

5
run.py
View File

@@ -44,6 +44,7 @@ def runmaa(id,tel,game,num=3):
for i in range(num):
global idnew,idold,idfail,idall,logx,logi
#创建MAA任务
time.sleep(10)
maa=subprocess.Popen([maapath])
maapid=maa.pid
#等待MAA启动
@@ -73,8 +74,8 @@ def runmaa(id,tel,game,num=3):
print(colored("运行日志:",'white'))
#读取并保存MAA日志
with open(logpath,'r',encoding='utf-8') as f:
logs=f.readlines()[-1:-10:-1]
print(colored(''.join(logs[::-1]),'light_green'))
logs=f.readlines()[-1:-11:-1]
print(colored(''.join(logs[::-1]),'light_green'),end='')
log=''.join(logs)
logx[logi]=log
logi=(logi+1) % len(logx)