2.0版本(去除对第三方代码的依赖,添加定时功能,主程序上线)

This commit is contained in:
DLmaster
2024-02-06 21:12:49 +08:00
parent 30bbf3823f
commit 9e93b6ef35
12 changed files with 131 additions and 173 deletions

29
AUTO_MAA.py Normal file
View File

@@ -0,0 +1,29 @@
import sqlite3
import subprocess
import datetime
import time
import os
from termcolor import colored
DATABASE="data/data.db"
db=sqlite3.connect(DATABASE)
cur=db.cursor()
cur.execute("SELECT * FROM timeset WHERE True")
timeset=cur.fetchall()
timeset=[list(row) for row in timeset]
while True:
curtime=datetime.datetime.now().strftime("%H:%M")
print(colored("当前时间:"+curtime,'green'))
timenew=[]
timenew.append(curtime)
if timenew in timeset:
print(colored("开始执行",'yellow'))
maa=subprocess.Popen(["run.exe"])
maapid=maa.pid
while True:
if os.path.exists("OVER"):
os.system('taskkill /F /T /PID '+str(maapid))
os.remove("OVER")
print(colored("执行完毕",'yellow'))
break
time.sleep(1)