From 365b1744e5dbbc840e0ca668aabb9df425a94fa4 Mon Sep 17 00:00:00 2001 From: LmeSzinc <37934724+LmeSzinc@users.noreply.github.com> Date: Wed, 12 Jun 2024 11:43:20 +0800 Subject: [PATCH] Chore: Treat invalid staring page of planner scan as GamePageUnknownError so error image can be saved --- module/alas.py | 2 +- tasks/planner/scan.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/module/alas.py b/module/alas.py index cd6cfbc03..f03f0a18b 100644 --- a/module/alas.py +++ b/module/alas.py @@ -101,7 +101,7 @@ class AzurLaneAutoScript: self.device.sleep(10) return False except GamePageUnknownError: - logger.info('Game server may be under maintenance or network may be broken, check server status now') + # logger.info('Game server may be under maintenance or network may be broken, check server status now') self.checker.check_now() if self.checker.is_available(): logger.critical('Game page unknown') diff --git a/tasks/planner/scan.py b/tasks/planner/scan.py index bca9b6fd8..5aa40be5f 100644 --- a/tasks/planner/scan.py +++ b/tasks/planner/scan.py @@ -4,6 +4,7 @@ import cv2 from pponnxcr.predict_system import BoxedResult from module.base.utils import area_center, area_in_area +from module.exception import GamePageUnknownError from module.logger import logger from module.ocr.ocr import Ocr, OcrWhiteLetterOnComplexBackground from module.ui.scroll import AdaptiveScroll @@ -173,7 +174,7 @@ class PlannerScan(SynthesizeUI, PlannerMixin): logger.hr('Parse planner result', level=2) if not self.ui_page_appear(page_planner): logger.error('Not in page_planner, game must in the planner result page before scanning') - return [] + raise GamePageUnknownError scroll = AdaptiveScroll(RESULT_SCROLL.button, name=RESULT_SCROLL.name) scroll.drag_threshold = 0.1