Skip to content

Commit e1e4dd8

Browse files
committed
Detect welcome screen via text
1 parent ee7ccdc commit e1e4dd8

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

mapadroid/ocr/screenPath.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -346,9 +346,12 @@ async def __handle_screentype(self, screentype: ScreenType,
346346
return screentype
347347

348348
async def __check_pogo_screen_ban_or_loading(self, screentype, y_offset: int = 0) -> ScreenType:
349-
backgroundcolor = await self._worker_state.pogo_windows.most_frequent_colour(await self.get_screenshot_path(),
349+
screenshot_path: str = await self.get_screenshot_path()
350+
backgroundcolor = await self._worker_state.pogo_windows.most_frequent_colour(screenshot_path,
350351
self._worker_state.origin,
351352
y_offset=y_offset)
353+
globaldict = await self._worker_state.pogo_windows.get_screen_text(screenshot_path, self._worker_state.origin)
354+
welcome_text = ['Willkommen', 'Welcome']
352355
if backgroundcolor is not None and (
353356
backgroundcolor[0] == 0 and
354357
backgroundcolor[1] == 0 and
@@ -362,9 +365,13 @@ async def __check_pogo_screen_ban_or_loading(self, screentype, y_offset: int = 0
362365
# Got a strike warning
363366
screentype = ScreenType.STRIKE
364367
elif backgroundcolor is not None and (
368+
any(text in welcome_text for text in globaldict['text']) or (
365369
backgroundcolor[0] == 18 and
366370
backgroundcolor[1] == 46 and
367-
backgroundcolor[2] == 86):
371+
backgroundcolor[2] == 86) or (
372+
backgroundcolor[0] == 55 and
373+
backgroundcolor[1] == 72 and
374+
backgroundcolor[2] == 88)):
368375
screentype = ScreenType.WELCOME
369376
return screentype
370377

0 commit comments

Comments
 (0)