Fix: 修复登录, 增加章节名OCR纠错

This commit is contained in:
LmeSzinc 2020-04-28 22:51:32 +08:00
parent 61aa7d8340
commit 088aca3c95
2 changed files with 10 additions and 3 deletions

View File

@ -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)

View File

@ -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