mirror of
https://github.com/TheFunny/ArisuAutoSweeper
synced 2025-12-16 22:05:12 +00:00
refactor(sweep): use regex for index match
This commit is contained in:
parent
32cee3f6b5
commit
257e092936
@ -1,3 +1,5 @@
|
|||||||
|
import re
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from module.base.base import ModuleBase
|
from module.base.base import ModuleBase
|
||||||
@ -50,7 +52,8 @@ class StageList:
|
|||||||
|
|
||||||
def load_stage_indexes(self, main: ModuleBase):
|
def load_stage_indexes(self, main: ModuleBase):
|
||||||
self.current_indexes = list(
|
self.current_indexes = list(
|
||||||
filter(lambda x: x.ocr_text.isdigit(), self.index_ocr.detect_and_ocr(main.device.image))
|
filter(lambda x: re.match(r'^\d{1,2}-?\d?$', x.ocr_text),
|
||||||
|
self.index_ocr.detect_and_ocr(main.device.image))
|
||||||
)
|
)
|
||||||
if not self.current_indexes:
|
if not self.current_indexes:
|
||||||
logger.warning(f'No valid index in {self.index_ocr.name}')
|
logger.warning(f'No valid index in {self.index_ocr.name}')
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user