From 088aca3c951e742df49b122d4e0697a069b503e6 Mon Sep 17 00:00:00 2001 From: LmeSzinc Date: Tue, 28 Apr 2020 22:51:32 +0800 Subject: [PATCH] =?UTF-8?q?Fix:=20=E4=BF=AE=E5=A4=8D=E7=99=BB=E5=BD=95,=20?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=AB=A0=E8=8A=82=E5=90=8DOCR=E7=BA=A0?= =?UTF-8?q?=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- module/campaign/campaign_ocr.py | 9 ++++++++- module/handler/login.py | 4 ++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/module/campaign/campaign_ocr.py b/module/campaign/campaign_ocr.py index 4f1c81afb..e458ee035 100644 --- a/module/campaign/campaign_ocr.py +++ b/module/campaign/campaign_ocr.py @@ -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) diff --git a/module/handler/login.py b/module/handler/login.py index e4096377f..03746dbdf 100644 --- a/module/handler/login.py +++ b/module/handler/login.py @@ -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