diff --git a/Underlying_Operations.py b/Underlying_Operations.py index 685aea8..ccdb95c 100644 --- a/Underlying_Operations.py +++ b/Underlying_Operations.py @@ -2495,7 +2495,7 @@ class underlying_operations: 注意:uiautomator 在某些设备上可能也需要权限,但可以尝试作为备选方案。 """ - + # 使用 uiautomator swipe 命令 # 注意:uiautomator 命令格式可能因 Android 版本而异 # Android 5.0+: uiautomator swipe [steps] @@ -2523,7 +2523,6 @@ class underlying_operations: 优点:绕过部分权限检查 缺点:需要 root 权限,实现复杂,不同设备的事件格式可能不同 """ - # 获取触摸设备路径(通常是 /dev/input/eventX) result = subprocess.run( diff --git a/douyin/core/state/reservations.json b/douyin/core/state/reservations.json index 8e01031..fef7263 100644 --- a/douyin/core/state/reservations.json +++ b/douyin/core/state/reservations.json @@ -1,121 +1,8 @@ { - "updated_ts": 1767490647.4599805, - "reason": "record_reservation", - "room_pos": 3, - "current_room_title": "带娃的小", - "current_room_title_raw": "带娃的小.", - "reservations": [ - { - "prize_value_yuan": 3499.0, - "content": "", - "future_ts": 1767491224.559842, - "future_str": "2026-01-04 09:47:04", - "pos_seen": 3, - "room_title": "带娃的小", - "room_title_raw": "带娃的小.", - "created_ts": 1767490541.6079862, - "task_count": 2, - "time_text": "11:28", - "participants": 0, - "copies": 0 - }, - { - "prize_value_yuan": 1999.0, - "content": "", - "future_ts": 1767491289.735911, - "future_str": "2026-01-04 09:48:09", - "pos_seen": 0, - "room_title": "作川帮粼", - "room_title_raw": "作川帮粼。。", - "created_ts": 1767490498.9667225, - "task_count": 2, - "time_text": "13:16", - "participants": 0, - "copies": 0 - }, - { - "prize_value_yuan": 1999.0, - "content": "", - "future_ts": 1767491289.793185, - "future_str": "2026-01-04 09:48:09", - "pos_seen": 0, - "room_title": "作小帮粼", - "room_title_raw": "作小帮粼。。", - "created_ts": 1767490410.0147398, - "task_count": 2, - "time_text": "14:45", - "participants": 0, - "copies": 0 - }, - { - "prize_value_yuan": 1999.0, - "content": "", - "future_ts": 1767491290.024826, - "future_str": "2026-01-04 09:48:10", - "pos_seen": 0, - "room_title": "作I帮粼", - "room_title_raw": "作I帮粼。。", - "created_ts": 1767490513.3146324, - "task_count": 2, - "time_text": "13:02", - "participants": 0, - "copies": 0 - }, - { - "prize_value_yuan": 1999.0, - "content": "", - "future_ts": 1767491290.032546, - "future_str": "2026-01-04 09:48:10", - "pos_seen": 0, - "room_title": "作小帮数", - "room_title_raw": "作小帮数。。", - "created_ts": 1767490484.413875, - "task_count": 2, - "time_text": "13:31", - "participants": 0, - "copies": 0 - }, - { - "prize_value_yuan": 1999.0, - "content": "", - "future_ts": 1767491290.039379, - "future_str": "2026-01-04 09:48:10", - "pos_seen": 0, - "room_title": "作小帮", - "room_title_raw": "作小帮\"。。", - "created_ts": 1767490439.3004336, - "task_count": 2, - "time_text": "14:16", - "participants": 0, - "copies": 0 - }, - { - "prize_value_yuan": 1999.0, - "content": "", - "future_ts": 1767491290.433496, - "future_str": "2026-01-04 09:48:10", - "pos_seen": 0, - "room_title": "作小羿敉", - "room_title_raw": "作小羿敉。。", - "created_ts": 1767490424.8472722, - "task_count": 2, - "time_text": "14:31", - "participants": 0, - "copies": 0 - }, - { - "prize_value_yuan": 1999.0, - "content": "", - "future_ts": 1767491291.276375, - "future_str": "2026-01-04 09:48:11", - "pos_seen": 0, - "room_title": "作川帮数", - "room_title_raw": "作川帮数。。", - "created_ts": 1767490469.6016176, - "task_count": 2, - "time_text": "13:47", - "participants": 0, - "copies": 0 - } - ] -} \ No newline at end of file + "updated_ts": 1767491032.6326447, + "reason": "startup_clear", + "room_pos": 0, + "current_room_title": "", + "current_room_title_raw": "", + "reservations": [] +} diff --git a/douyin/fudai/core/fudai_result_checker.py b/douyin/fudai/core/fudai_result_checker.py index 7f36803..191c224 100644 --- a/douyin/fudai/core/fudai_result_checker.py +++ b/douyin/fudai/core/fudai_result_checker.py @@ -11,6 +11,7 @@ from typing import Any try: from douyin.utils.ocr_preprocess import preprocess_for_ocr # type: ignore except Exception: # pyright: ignore + def preprocess_for_ocr(_analyser, picname: str) -> str: # type: ignore try: return str(picname) diff --git a/douyin/handlers/douyin_swipe_handler.py b/douyin/handlers/douyin_swipe_handler.py index aae7481..d1dd60a 100644 --- a/douyin/handlers/douyin_swipe_handler.py +++ b/douyin/handlers/douyin_swipe_handler.py @@ -8,6 +8,7 @@ - 滑动次数重置 - 返回推荐页并重新进入 """ + from __future__ import annotations import time diff --git a/douyin/reservation/douyin_reservation_handler.py b/douyin/reservation/douyin_reservation_handler.py index 4f2e7f2..e84f3c1 100644 --- a/douyin/reservation/douyin_reservation_handler.py +++ b/douyin/reservation/douyin_reservation_handler.py @@ -8,6 +8,7 @@ - 根据标题查找位置 - 记录直播间标题和位置 """ + from __future__ import annotations import time diff --git a/douyin/reservation/douyin_reservation_logic.py b/douyin/reservation/douyin_reservation_logic.py index 7ddf603..08ba130 100644 --- a/douyin/reservation/douyin_reservation_logic.py +++ b/douyin/reservation/douyin_reservation_logic.py @@ -327,7 +327,14 @@ def add_reservation_core_logic( is_similar_room_title and is_similar_time and is_same_prize_value - and is_similar_content + and ( + is_similar_content + or ( + # 如果内容核心均为空(OCR 未识别到内容),则允许仅凭直播间名称相似、时间接近和价值相同判定为重复 + not content_core + and not r_content_core + ) + ) ): # 通过相似度匹配判断为同一个预约(处理OCR误差) same_idx = idx diff --git a/fudai_detail_modules/fudai_detail_room_title.py b/fudai_detail_modules/fudai_detail_room_title.py index f453d49..fb38855 100644 --- a/fudai_detail_modules/fudai_detail_room_title.py +++ b/fudai_detail_modules/fudai_detail_room_title.py @@ -4,6 +4,7 @@ 处理直播间标题的OCR识别、噪音过滤、规范化等功能。 """ + from __future__ import annotations from typing import Any, Tuple, List