mirror of
https://github.com/LmeSzinc/StarRailCopilot.git
synced 2024-12-03 12:23:53 +00:00
Fix: 修复登录, 增加章节名OCR纠错
This commit is contained in:
parent
61aa7d8340
commit
088aca3c95
@ -31,6 +31,13 @@ def ensure_chapter_index(name):
|
||||
return 2
|
||||
|
||||
|
||||
def ocr_result_process(result):
|
||||
result = result.lower().replace('--', '-')
|
||||
if len(result) == 2 and result[0].isdigit():
|
||||
result = '-'.join(result)
|
||||
return result
|
||||
|
||||
|
||||
def separate_name(name):
|
||||
"""
|
||||
Args:
|
||||
@ -145,7 +152,7 @@ class CampaignOcr:
|
||||
result = ocr.ocr(image)
|
||||
if not isinstance(result, list):
|
||||
result = [result]
|
||||
result = [res.lower().replace('--', '-') for res in result]
|
||||
result = [ocr_result_process(res) for res in result]
|
||||
|
||||
chapter = [separate_name(res)[0] for res in result]
|
||||
counter = collections.Counter(chapter)
|
||||
|
@ -33,8 +33,8 @@ class LoginHandler(Combat):
|
||||
if confirm_timer.reached():
|
||||
logger.info('Login to main confirm')
|
||||
break
|
||||
else:
|
||||
confirm_timer.reset()
|
||||
else:
|
||||
confirm_timer.reset()
|
||||
|
||||
return True
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user