feat: 增强直播间去重统计逻辑,添加当前直播间位置和相关集合
This commit is contained in:
1 parent
3283cd3653
commit
e771197a3a
2 files changed
+62
-15
No files matched your search
+6
-6
@@ -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
|
||||
}
|
||||
+56
-9
@@ -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:
|
||||
|
||||
Reference in new issue
Block a user