mirror of
https://github.com/TheFunny/ArisuAutoSweeper
synced 2025-12-16 22:05:12 +00:00
fix(ocr): force substitute % with / in DigitCounter
This commit is contained in:
parent
bd0749c058
commit
b2ae30b45c
@ -349,6 +349,11 @@ class DigitCounter(Ocr):
|
|||||||
def __init__(self, button: ButtonWrapper, lang='en', name=None):
|
def __init__(self, button: ButtonWrapper, lang='en', name=None):
|
||||||
super().__init__(button, lang=lang, name=name)
|
super().__init__(button, lang=lang, name=name)
|
||||||
|
|
||||||
|
def after_process(self, result):
|
||||||
|
result = super().after_process(result)
|
||||||
|
result = result.replace('%', '/')
|
||||||
|
return result
|
||||||
|
|
||||||
def format_result(self, result) -> tuple[int, int, int]:
|
def format_result(self, result) -> tuple[int, int, int]:
|
||||||
"""
|
"""
|
||||||
Do OCR on a counter, such as `14/15`, and returns 14, 1, 15
|
Do OCR on a counter, such as `14/15`, and returns 14, 1, 15
|
||||||
@ -356,7 +361,7 @@ class DigitCounter(Ocr):
|
|||||||
Returns:
|
Returns:
|
||||||
int:
|
int:
|
||||||
"""
|
"""
|
||||||
result = super().after_process(result)
|
result = self.after_process(result)
|
||||||
logger.attr(name=self.name, text=str(result))
|
logger.attr(name=self.name, text=str(result))
|
||||||
|
|
||||||
res = re.search(r'(\d+)/(\d+)', result)
|
res = re.search(r'(\d+)/(\d+)', result)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user