mirror of
https://github.com/LmeSzinc/AzurLaneAutoScript.git
synced 2025-01-09 05:47:30 +08:00
Add: Delete sensitive info in log images
This commit is contained in:
parent
0550ea3cd1
commit
5982e44dd7
5
alas.py
5
alas.py
@ -6,7 +6,7 @@ from datetime import datetime
|
||||
from module.config.config import AzurLaneConfig
|
||||
from module.device.device import Device
|
||||
from module.logger import logger, pyw_name, log_file
|
||||
from module.update import Update
|
||||
from module.handler.sensitive_info import handle_sensitive_image
|
||||
|
||||
|
||||
class AzurLaneAutoScript:
|
||||
@ -31,7 +31,8 @@ class AzurLaneAutoScript:
|
||||
os.mkdir(folder)
|
||||
for data in logger.screenshot_deque:
|
||||
image_time = datetime.strftime(data['time'], '%Y-%m-%d_%H-%M-%S-%f')
|
||||
data['image'].save(f'{folder}/{image_time}.png')
|
||||
image = handle_sensitive_image(data['image'])
|
||||
image.save(f'{folder}/{image_time}.png')
|
||||
with open(log_file, 'r') as f:
|
||||
start = 0
|
||||
for index, line in enumerate(f.readlines()):
|
||||
|
BIN
assets/cn/ui/PLAYER_CHECK.png
Normal file
BIN
assets/cn/ui/PLAYER_CHECK.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.5 KiB |
BIN
assets/mask/MASK_MAIN.png
Normal file
BIN
assets/mask/MASK_MAIN.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.9 KiB |
BIN
assets/mask/MASK_PLAYER.png
Normal file
BIN
assets/mask/MASK_PLAYER.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.9 KiB |
34
module/handler/sensitive_info.py
Normal file
34
module/handler/sensitive_info.py
Normal file
@ -0,0 +1,34 @@
|
||||
from PIL import Image
|
||||
|
||||
from module.ui.page import *
|
||||
|
||||
|
||||
def put_image_mask(image, mask):
|
||||
"""
|
||||
Args:
|
||||
image (PIL.Image.Image):
|
||||
mask (str): Filename
|
||||
|
||||
Returns:
|
||||
PIL.Image.Image:
|
||||
"""
|
||||
mask = Image.open(f'./assets/mask/{mask}.png').convert('L')
|
||||
new = Image.new('RGB', image.size, (0, 0, 0))
|
||||
new.paste(image, box=(0, 0, image.size[0], image.size[1]), mask=mask)
|
||||
return new
|
||||
|
||||
|
||||
def handle_sensitive_image(image):
|
||||
"""
|
||||
Args:
|
||||
image (PIL.Image.Image):
|
||||
|
||||
Returns:
|
||||
PIL.Image.Image:
|
||||
"""
|
||||
if PLAYER_CHECK.match(image, offset=(30, 30)):
|
||||
return put_image_mask(image, mask='MASK_PLAYER')
|
||||
if MAIN_CHECK.match(image, offset=(30, 30)):
|
||||
return put_image_mask(image, mask='MASK_MAIN')
|
||||
|
||||
return image
|
@ -23,6 +23,7 @@ MAIN_GOTO_MISSION = Button(area={'cn': (816, 666, 932, 713), 'en': (818, 667, 95
|
||||
MAIN_GOTO_RAID = Button(area={'cn': (1008, 289, 1154, 435), 'en': (1013, 298, 1148, 363), 'jp': (1006, 288, 1155, 436)}, color={'cn': (216, 171, 99), 'en': (234, 198, 121), 'jp': (216, 171, 100)}, button={'cn': (610, 264, 654, 305), 'en': (610, 264, 654, 305), 'jp': (606, 264, 653, 305)}, file={'cn': './assets/cn/ui/MAIN_GOTO_RAID.png', 'en': './assets/en/ui/MAIN_GOTO_RAID.png', 'jp': './assets/jp/ui/MAIN_GOTO_RAID.png'})
|
||||
MAIN_GOTO_REWARD = Button(area={'cn': (11, 139, 30, 189), 'en': (11, 139, 30, 189), 'jp': (11, 139, 30, 189)}, color={'cn': (69, 81, 115), 'en': (69, 81, 115), 'jp': (69, 81, 115)}, button={'cn': (11, 139, 30, 189), 'en': (11, 139, 30, 189), 'jp': (11, 139, 30, 189)}, file={'cn': './assets/cn/ui/MAIN_GOTO_REWARD.png', 'en': './assets/en/ui/MAIN_GOTO_REWARD.png', 'jp': './assets/jp/ui/MAIN_GOTO_REWARD.png'})
|
||||
MISSION_CHECK = Button(area={'cn': (120, 15, 173, 40), 'en': (123, 18, 221, 37), 'jp': (120, 14, 173, 40)}, color={'cn': (141, 156, 194), 'en': (104, 117, 158), 'jp': (150, 165, 202)}, button={'cn': (120, 15, 173, 40), 'en': (123, 18, 221, 37), 'jp': (120, 14, 173, 40)}, file={'cn': './assets/cn/ui/MISSION_CHECK.png', 'en': './assets/en/ui/MISSION_CHECK.png', 'jp': './assets/jp/ui/MISSION_CHECK.png'})
|
||||
PLAYER_CHECK = Button(area={'cn': (28, 668, 139, 688), 'en': (28, 668, 139, 688), 'jp': (28, 668, 139, 688)}, color={'cn': (237, 204, 127), 'en': (237, 204, 127), 'jp': (237, 204, 127)}, button={'cn': (28, 668, 139, 688), 'en': (28, 668, 139, 688), 'jp': (28, 668, 139, 688)}, file={'cn': './assets/cn/ui/PLAYER_CHECK.png', 'en': './assets/cn/ui/PLAYER_CHECK.png', 'jp': './assets/cn/ui/PLAYER_CHECK.png'})
|
||||
RAID_CHECK = Button(area={'cn': (118, 14, 227, 39), 'en': (115, 9, 262, 42), 'jp': (118, 14, 226, 39)}, color={'cn': (143, 161, 202), 'en': (82, 98, 136), 'jp': (149, 167, 206)}, button={'cn': (118, 14, 227, 39), 'en': (115, 9, 262, 42), 'jp': (118, 14, 226, 39)}, file={'cn': './assets/cn/ui/RAID_CHECK.png', 'en': './assets/en/ui/RAID_CHECK.png', 'jp': './assets/jp/ui/RAID_CHECK.png'})
|
||||
REWARD_CHECK = Button(area={'cn': (302, 119, 371, 195), 'en': (302, 119, 371, 195), 'jp': (302, 119, 371, 195)}, color={'cn': (146, 118, 120), 'en': (146, 118, 120), 'jp': (146, 118, 120)}, button={'cn': (302, 119, 371, 195), 'en': (302, 119, 371, 195), 'jp': (302, 119, 371, 195)}, file={'cn': './assets/cn/ui/REWARD_CHECK.png', 'en': './assets/en/ui/REWARD_CHECK.png', 'jp': './assets/jp/ui/REWARD_CHECK.png'})
|
||||
REWARD_GOTO_COMMISSION = Button(area={'cn': (383, 262, 503, 302), 'en': (384, 261, 503, 304), 'jp': (383, 262, 502, 302)}, color={'cn': (91, 136, 199), 'en': (89, 133, 197), 'jp': (92, 136, 199)}, button={'cn': (383, 262, 503, 302), 'en': (384, 261, 503, 304), 'jp': (383, 262, 502, 302)}, file={'cn': './assets/cn/ui/REWARD_GOTO_COMMISSION.png', 'en': './assets/en/ui/REWARD_GOTO_COMMISSION.png', 'jp': './assets/jp/ui/REWARD_GOTO_COMMISSION.png'})
|
||||
|
Loading…
Reference in New Issue
Block a user