2021-05-25 13:30:53 +00:00
|
|
|
|
import os
|
2021-05-27 13:25:58 +00:00
|
|
|
|
import sys
|
2021-05-25 13:30:53 +00:00
|
|
|
|
import main
|
|
|
|
|
import time
|
|
|
|
|
import tools
|
|
|
|
|
import config
|
2021-06-06 09:50:00 +00:00
|
|
|
|
import random
|
2021-05-26 10:11:27 +00:00
|
|
|
|
import setting
|
2021-05-25 13:30:53 +00:00
|
|
|
|
|
|
|
|
|
#搜索配置文件
|
|
|
|
|
def Fund_config() ->list:
|
|
|
|
|
file_Name=[]
|
|
|
|
|
for files in os.listdir(config.path):
|
|
|
|
|
if os.path.splitext(files)[1] == '.json':
|
|
|
|
|
file_Name.append(files)
|
|
|
|
|
return (file_Name)
|
|
|
|
|
|
2021-06-13 02:33:38 +00:00
|
|
|
|
def main_multi(autorun:bool):
|
2021-05-25 13:30:53 +00:00
|
|
|
|
tools.log.info("AutoMihoyoBBS Multi User mode")
|
|
|
|
|
tools.log.info("正在搜索配置文件!")
|
|
|
|
|
config_List = Fund_config()
|
2021-06-06 13:19:28 +00:00
|
|
|
|
if len(config_List) == 0:
|
2021-05-27 13:25:58 +00:00
|
|
|
|
tools.log.warn("未检测到配置文件,请确认config文件夹存在.json后缀名的配置文件!")
|
|
|
|
|
exit()
|
2021-06-13 02:33:38 +00:00
|
|
|
|
if autorun:
|
2021-05-29 01:34:21 +00:00
|
|
|
|
tools.log.info(f"已搜索到{len(config_List)}个配置文件,正在开始执行!")
|
|
|
|
|
else:
|
2021-05-28 11:27:07 +00:00
|
|
|
|
tools.log.info(f"已搜索到{len(config_List)}个配置文件,请确认是否无多余文件!\r\n{config_List}")
|
2021-05-30 04:27:16 +00:00
|
|
|
|
try:
|
|
|
|
|
input("请输入回车继续,需要重新搜索配置文件请Ctrl+C退出脚本")
|
|
|
|
|
except:
|
|
|
|
|
exit()
|
2021-05-25 13:30:53 +00:00
|
|
|
|
for i in iter(config_List):
|
|
|
|
|
tools.log.info(f"正在执行{i}")
|
2021-05-26 10:11:27 +00:00
|
|
|
|
setting.mihoyobbs_List_Use = []
|
2021-05-25 13:30:53 +00:00
|
|
|
|
config.config_Path= f"{config.path}/{i}"
|
|
|
|
|
main.main()
|
|
|
|
|
tools.log.info(f"{i}执行完毕")
|
2021-07-17 03:07:38 +00:00
|
|
|
|
time.sleep(random.randint(3, 10))
|
2021-05-25 13:30:53 +00:00
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
2021-06-13 02:33:38 +00:00
|
|
|
|
if len(sys.argv) >= 2 and sys.argv[1] == "autorun":
|
|
|
|
|
autorun = True
|
|
|
|
|
else:
|
|
|
|
|
autorun = False
|
|
|
|
|
main_multi(autorun)
|
2021-05-30 04:27:16 +00:00
|
|
|
|
sys.exit(0)
|
2021-05-25 13:30:53 +00:00
|
|
|
|
pass
|