diff --git a/Utils/AiUtils.py b/Utils/AiUtils.py index 55f5f33..6373daf 100644 --- a/Utils/AiUtils.py +++ b/Utils/AiUtils.py @@ -41,7 +41,6 @@ class AiUtils(object): # 检查是否有匹配结果 if loc[0].size > 0: - print("匹配到目标了") # 取第一个匹配位置 pt = zip(*loc[::-1]).__next__() # 获取第一个匹配点的坐标 center_x = int(pt[0] + w // 2) @@ -49,11 +48,11 @@ class AiUtils(object): # print(f"第一个匹配到的小心心中心坐标: ({center_x}, {center_y})") return center_x, center_y else: - print("未找到匹配的目标") return -1, -1 except Exception as e: LogManager.error(f"加载素材失败:{e}", udid) print(e) + return -1, -1 # 使用正则查找字符串中的数字 @classmethod @@ -215,7 +214,7 @@ class AiUtils(object): def findCloseButton(cls,udid="eca000fcb6f55d7ed9b4c524055214c26a7de7aa"): client = wda.USBClient(udid) session = client.session() - session.appium_settings({"snapshotMaxDepth": 30}) + session.appium_settings({"snapshotMaxDepth": 0}) r = session.xpath("//XCUIElementTypeButton[@name='关闭屏幕']") try: if r.label == "关闭屏幕": diff --git a/Utils/ThreadManager.py b/Utils/ThreadManager.py index e1381d7..a2f7532 100644 --- a/Utils/ThreadManager.py +++ b/Utils/ThreadManager.py @@ -17,11 +17,12 @@ class ThreadManager(): @classmethod def stop(cls, udid): + print(cls.threads) info = cls.threads[udid] if info: info["stopEvent"].set() # 停止线程 info["thread"].join(timeout=3) # 等待线程退出 del cls.threads[udid] - LogManager.info("停止线程成功") + LogManager.info("停止线程成功", udid) else: - LogManager.info("无此线程,无需关闭") \ No newline at end of file + LogManager.info("无此线程,无需关闭", udid) \ No newline at end of file diff --git a/resources/eca000fcb6f55d7ed9b4c524055214c26a7de7aa/bgv.png b/resources/eca000fcb6f55d7ed9b4c524055214c26a7de7aa/bgv.png index 934012d..6e32b37 100644 Binary files a/resources/eca000fcb6f55d7ed9b4c524055214c26a7de7aa/bgv.png and b/resources/eca000fcb6f55d7ed9b4c524055214c26a7de7aa/bgv.png differ diff --git a/script/ScriptManager.py b/script/ScriptManager.py index df14e3e..ec33dac 100644 --- a/script/ScriptManager.py +++ b/script/ScriptManager.py @@ -69,7 +69,7 @@ class ScriptManager(): # 查找首页按钮 homeButton = AiUtils.findHomeButton(udid) if homeButton: - print("查看视频") + print("有首页按钮,查看视频") videoTime = random.randint(5, 15) time.sleep(videoTime) @@ -84,7 +84,7 @@ class ScriptManager(): print("准备划到下一个视频") client.swipe_up() else: - print("目前没有首页按钮。需要另外处理") + print("找不到首页按钮。出错了") else: nextTime = random.randint(1, 5) time.sleep(nextTime)