mirror of
https://github.com/LmeSzinc/StarRailCopilot.git
synced 2024-11-16 06:25:24 +00:00
Update data_update.py for removing whitespace in credit ocr result (#441)
* Update data_update.py for removing whitespace in credit ocr result sometimes ocr provides a str like '1 2261000' and conversion to int int('1 2261000') fails. we do a post process here, removing the whitespace and allow the conversion to be successful * Update data_update.py for removing whitespace in credit ocr result sometimes ocr provides a str like '1 2261000' and conversion to int int('1 2261000') fails. we do a post process here, removing the whitespace and allow the conversion to be successful edited to align with standards of this repo
This commit is contained in:
parent
aa40215cb8
commit
0f33ba733e
@ -1,3 +1,5 @@
|
||||
import re
|
||||
|
||||
from module.base.timer import Timer
|
||||
from module.logger import logger
|
||||
from module.ocr.ocr import Digit
|
||||
@ -19,7 +21,7 @@ class DataUpdate(UI):
|
||||
while 1:
|
||||
data = ocr.detect_and_ocr(self.device.image)
|
||||
if len(data) == 2:
|
||||
credit, jade = [int(d.ocr_text) for d in data]
|
||||
credit, jade = [int(re.sub(r'\s', '', d.ocr_text)) for d in data]
|
||||
if credit > 0 or jade > 0:
|
||||
break
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user