From 5725cad98a147479cca024b98a50473a21ba93da Mon Sep 17 00:00:00 2001 From: Eswar Balasubramanian Date: Sun, 21 Jan 2024 19:09:29 +0530 Subject: [PATCH 1/2] Windows environment fixes --- bot.py | 2 +- requirements.txt | 2 +- screenshot.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bot.py b/bot.py index e935f9c..4e1542e 100644 --- a/bot.py +++ b/bot.py @@ -108,7 +108,7 @@ def run(): max_coords = coords # Check if the maximum value is above a certain threshold - if max_val > 0.95: + if max_val > 0.90: logging.info(f"Image {max_image_file} matches with {max_val * 100}%") # If not ingame reset timer diff --git a/requirements.txt b/requirements.txt index d814dfa..13460b0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,2 @@ -numpy==1.24.1 +numpy==1.26.0 opencv-python==4.7.0.68 diff --git a/screenshot.py b/screenshot.py index b576311..96c77c1 100644 --- a/screenshot.py +++ b/screenshot.py @@ -6,6 +6,6 @@ def capture_screenshot(filename): Captures a screenshot of the Android screen using adb and saves it to a file. Returns True if the adb command was successful, False otherwise. """ - adb_command = "adb exec-out screencap -p > {} 2> /dev/null".format(filename) + adb_command = "adb exec-out screencap -p > {}".format(filename) error_code = os.system(adb_command) return error_code == 0 From 2dda92265b020ad5af7c6edf5f709d8257c569c6 Mon Sep 17 00:00:00 2001 From: Ma <101021254+CodeWithMa@users.noreply.github.com> Date: Wed, 24 Jan 2024 17:44:07 +0100 Subject: [PATCH 2/2] Check platform.system() to use different adb command for windows --- screenshot.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/screenshot.py b/screenshot.py index 96c77c1..aec47e2 100644 --- a/screenshot.py +++ b/screenshot.py @@ -1,4 +1,5 @@ import os +import platform def capture_screenshot(filename): @@ -6,6 +7,9 @@ def capture_screenshot(filename): Captures a screenshot of the Android screen using adb and saves it to a file. Returns True if the adb command was successful, False otherwise. """ - adb_command = "adb exec-out screencap -p > {}".format(filename) + if platform.system() == "Windows": + adb_command = "adb exec-out screencap -p > {}".format(filename) + else: + adb_command = "adb exec-out screencap -p > {} 2> /dev/null".format(filename) error_code = os.system(adb_command) return error_code == 0