From e771197a3abfb4aa33448d3684e196e312e61d7d Mon Sep 17 00:00:00 2001 From: Your Name Date: Sun, 4 Jan 2026 15:45:01 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A2=9E=E5=BC=BA=E7=9B=B4=E6=92=AD?= =?UTF-8?q?=E9=97=B4=E5=8E=BB=E9=87=8D=E7=BB=9F=E8=AE=A1=E9=80=BB=E8=BE=91?= =?UTF-8?q?=EF=BC=8C=E6=B7=BB=E5=8A=A0=E5=BD=93=E5=89=8D=E7=9B=B4=E6=92=AD?= =?UTF-8?q?=E9=97=B4=E4=BD=8D=E7=BD=AE=E5=92=8C=E7=9B=B8=E5=85=B3=E9=9B=86?= =?UTF-8?q?=E5=90=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/config.json | 12 ++++----- gui/gui_core.py | 65 +++++++++++++++++++++++++++++++++++++++------- 2 files changed, 62 insertions(+), 15 deletions(-) diff --git a/config/config.json b/config/config.json index 7c18b44..34997f9 100644 --- a/config/config.json +++ b/config/config.json @@ -37,14 +37,14 @@ "fudai_detail_save_debug_images": true, "fudai_disable_content_recognition": true, "fudai_disable_task_recognition": true, - "yanghao_recommend_duration_seconds": 206, - "yanghao_recommend_interval_seconds": 570, + "yanghao_recommend_duration_seconds": 300, + "yanghao_recommend_interval_seconds": 600, "yanghao_like_prob": 1.0, "yanghao_fav_prob": 0.85, "yanghao_comment_prob": 1.0, "yanghao_icon_roi_size": 240, "yanghao_icon_match_threshold": 0.77, - "yanghao_step_screenshot": false, + "yanghao_step_screenshot": true, "yanghao_like_roi_offset_x": 0, "yanghao_like_roi_offset_y": -50, "yanghao_fav_roi_offset_x": 40, @@ -57,8 +57,8 @@ "fudai_quiet_hours_enabled": true, "fudai_quiet_start_hour": 2, "fudai_quiet_end_hour": 9, - "yanghao_enabled": false, - "yanghao_enable_actions": false, + "yanghao_enabled": true, + "yanghao_enable_actions": true, "yanghao_like_icon_x": 0, "yanghao_like_icon_y": -1, "yanghao_fav_icon_x": -1, @@ -190,5 +190,5 @@ "fansclub_manual_wait_seconds": 3.0, "enable_streaming_screenshot": false, "fudai_exit_after_misses": 30, - "yanghao_only": false + "yanghao_only": true } diff --git a/gui/gui_core.py b/gui/gui_core.py index a88d66e..d2feaf0 100644 --- a/gui/gui_core.py +++ b/gui/gui_core.py @@ -130,6 +130,13 @@ class Runner: self._unique_keys_seen: set[str] = set() self._unique_keys_open: set[str] = set() self._unique_keys_attend: set[str] = set() + # 当前直播间位置(从日志中解析),用于按直播间去重统计 + self._current_room_pos: int | None = None + # 按直播间去重集合(优先使用 room_pos;若不可用则回退到 content/prize/countdown key) + self._fudai_seen_room_pos: set[int] = set() + self._fudai_open_room_pos: set[int] = set() + self._fudai_attend_ok_room_pos: set[int] = set() + self._fudai_attend_fail_room_pos: set[int] = set() def is_running(self) -> bool: return self._proc is not None and self._proc.poll() is None @@ -214,12 +221,21 @@ class Runner: if content_extracted: self._inc("fudai_seen") self._record_event("fudai_seen", self._snapshot_fudai()) - # 唯一口径:基于 snapshot 的 content/prize/countdown 去重 + # 唯一口径:优先按当前直播间位置去重(每个直播间只记一次),回退到 content/prize/countdown 三元组 try: - key = self._make_unique_key() - if key and key not in self._unique_keys_seen: - self._unique_keys_seen.add(key) - self._inc("fudai_seen_unique") + if self._current_room_pos is not None: + try: + rp = int(self._current_room_pos) + except Exception: + rp = None + if rp is not None and rp not in self._fudai_seen_room_pos: + self._fudai_seen_room_pos.add(rp) + self._inc("fudai_seen_unique") + else: + key = self._make_unique_key() + if key and key not in self._unique_keys_seen: + self._unique_keys_seen.add(key) + self._inc("fudai_seen_unique") except Exception: pass @@ -308,15 +324,46 @@ class Runner: self._inc("fudai_attend_ok") self._record_event("fudai_attend_ok", self._snapshot_fudai()) try: - key = self._make_unique_key() - if key and key not in self._unique_keys_attend: - self._unique_keys_attend.add(key) - self._inc("fudai_attend_ok_unique") + # 优先按直播间去重 + if self._current_room_pos is not None: + try: + rp = int(self._current_room_pos) + except Exception: + rp = None + if rp is not None and rp not in self._fudai_attend_ok_room_pos: + self._fudai_attend_ok_room_pos.add(rp) + self._inc("fudai_attend_ok_unique") + else: + key = self._make_unique_key() + if key and key not in self._unique_keys_attend: + self._unique_keys_attend.add(key) + self._inc("fudai_attend_ok_unique") except Exception: pass if "参与抽奖失败" in s or ("[参与]" in s and "结果=失败" in s): self._inc("fudai_attend_fail") self._record_event("fudai_attend_fail", self._snapshot_fudai()) + try: + # 优先按直播间去重 + if self._current_room_pos is not None: + try: + rp = int(self._current_room_pos) + except Exception: + rp = None + if rp is not None and rp not in self._fudai_attend_fail_room_pos: + self._fudai_attend_fail_room_pos.add(rp) + self._inc("fudai_attend_fail_unique") + else: + # 回退到 key 去重(使用相同的 unique_keys_attend 集合) + try: + key = self._make_unique_key() + if key and key not in self._unique_keys_attend: + self._unique_keys_attend.add(key) + self._inc("fudai_attend_fail_unique") + except Exception: + pass + except Exception: + pass # --- 福袋:跳过/过滤原因 --- if "参与人数" in s and "< 阈值" in s and "不参与" in s: