mirror of
https://gitee.com/sui-feng-cb/AzurLaneAutoScript1
synced 2026-03-12 13:17:00 +08:00
Opt: Add Ocr.SHOW_REVISE_WARNING
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import re
|
||||
import time
|
||||
from datetime import timedelta
|
||||
from typing import TYPE_CHECKING
|
||||
@@ -21,6 +20,7 @@ else:
|
||||
|
||||
class Ocr:
|
||||
SHOW_LOG = True
|
||||
SHOW_REVISE_WARNING = False
|
||||
|
||||
def __init__(self, buttons, lang='azur_lane', letter=(255, 255, 255), threshold=128, alphabet=None, name=None):
|
||||
"""
|
||||
@@ -102,7 +102,7 @@ class Ocr:
|
||||
|
||||
if len(self.buttons) == 1:
|
||||
result_list = result_list[0]
|
||||
if Ocr.SHOW_LOG:
|
||||
if self.SHOW_LOG:
|
||||
logger.attr(name='%s %ss' % (self.name, float2str(time.time() - start_time)),
|
||||
text=str(result_list))
|
||||
|
||||
@@ -152,8 +152,9 @@ class Digit(Ocr):
|
||||
|
||||
prev = result
|
||||
result = int(result) if result else 0
|
||||
if str(result) != prev:
|
||||
logger.warning(f'OCR {self.name}: Result "{prev}" is revised to "{result}"')
|
||||
if self.SHOW_REVISE_WARNING:
|
||||
if str(result) != prev:
|
||||
logger.warning(f'OCR {self.name}: Result "{prev}" is revised to "{result}"')
|
||||
|
||||
return result
|
||||
|
||||
|
||||
Reference in New Issue
Block a user