1
0
mirror of https://gitee.com/sui-feng-cb/AzurLaneAutoScript1 synced 2026-03-19 02:33:34 +08:00

Add: 增加了出错时保存log和截图的功能

- 更改了Log的目录名称
This commit is contained in:
LmeSzinc
2020-04-16 14:05:37 +08:00
parent b94baf8831
commit 49ddd8d85f
8 changed files with 43 additions and 8 deletions

View File

@@ -210,6 +210,7 @@ def main(ini_name=''):
emulator.add_argument('--包名', default=default('--包名'), help='如果不是Biliibli国服, 或者使用了非官方客户端, 需修改')
debug = emulator_parser.add_argument_group('调试设置', '')
debug.add_argument('--出错时保存log和截图', default=default('--出错时保存log和截图'), choices=['', ''])
debug.add_argument('--保存透视识别出错的图像', default=default('--保存透视识别出错的图像'), choices=['', ''])
adb = emulator_parser.add_argument_group('ADB设置', '')
@@ -309,7 +310,4 @@ def main(ini_name=''):
# Call AzurLaneAutoScript
alas = AzurLaneAutoScript(ini_name=ini_name)
try:
alas.__getattribute__(command.lower())()
except Exception as e:
logger.exception(e)
alas.run(command=command)

View File

@@ -169,7 +169,10 @@ class AzurLaneConfig:
"""
error_log
"""
PERSPECTIVE_ERROR_LOG_FOLDER = './log/perspective_error'
ERROR_LOG_FOLDER = './log/error'
ENABLE_ERROR_LOG_AND_SCREENSHOT_SAVE = True
ENABLE_PERSPECTIVE_ERROR_IMAGE_SAVE = False
"""
module.map.fleet
@@ -238,7 +241,7 @@ class AzurLaneConfig:
),
MID_DIFF_RANGE
)
ENABLE_PERSPECTIVE_ERROR_IMAGE_SAVE = False
"""
module.daemon
"""
@@ -291,7 +294,8 @@ class AzurLaneConfig:
def create_folder(self):
self.SCREEN_SHOT_SAVE_FOLDER = self.SCREEN_SHOT_SAVE_FOLDER_BASE + '/' + self.CAMPAIGN_NAME
for folder in [self.SCREEN_SHOT_SAVE_FOLDER_BASE, self.ASSETS_FOLDER, self.SCREEN_SHOT_SAVE_FOLDER, self.ERROR_LOG_FOLDER]:
for folder in [self.SCREEN_SHOT_SAVE_FOLDER_BASE, self.ASSETS_FOLDER, self.SCREEN_SHOT_SAVE_FOLDER,
self.PERSPECTIVE_ERROR_LOG_FOLDER, self.ERROR_LOG_FOLDER]:
if not os.path.exists(folder):
os.mkdir(folder)
@@ -333,6 +337,7 @@ class AzurLaneConfig:
option = config['Emulator']
self.SERIAL = option['serial']
self.PACKAGE_NAME = option['package_name'].strip()
self.ENABLE_ERROR_LOG_AND_SCREENSHOT_SAVE = to_bool(option['enable_error_log_and_screenshot_save'])
self.ENABLE_PERSPECTIVE_ERROR_IMAGE_SAVE = to_bool(option['enable_perspective_error_image_save'])
self.USE_ADB_SCREENSHOT = to_bool(option['use_adb_screenshot'])
self.USE_ADB_CONTROL = to_bool(option['use_adb_control'])

View File

@@ -105,6 +105,7 @@ dic_chi_to_eng = {
'观舰类紧急委托': 'urgent_ship',
'设备': 'serial',
'包名': 'package_name',
'出错时保存log和截图': 'enable_error_log_and_screenshot_save',
'保存透视识别出错的图像': 'enable_perspective_error_image_save',
'使用ADB截图': 'use_adb_screenshot',
'使用ADB点击': 'use_adb_control',