feat: 更新高价值房间数据,调整时间戳和查看次数,增加新房间信息
This commit is contained in:
1 parent
51eced1346
commit
d739998b6b
3 files changed
+105
-127
No files matched your search
@@ -1121,93 +1121,3 @@ def read_pixel_stage_state_from_screenshot(
|
||||
if return_details:
|
||||
return state, details
|
||||
return state
|
||||
|
||||
# 模板匹配已删除,只使用像素检测
|
||||
|
||||
detection_tasks = {
|
||||
"has_coupon_bg": lambda pic: detect_coupon_popup_background(
|
||||
pic,
|
||||
return_info=True,
|
||||
template_threshold=coupon_threshold,
|
||||
analyser=analyser,
|
||||
),
|
||||
"has_redpacket_bg": detect_redpacket_popup_background,
|
||||
"has_lucky_draw_result": lambda pic: detect_lucky_draw_result_popup(
|
||||
pic, lucky_draw_red_ratio_threshold, return_info=True
|
||||
),
|
||||
"has_attend_button_red": lambda pic: detect_attend_button_red_area(
|
||||
pic,
|
||||
return_info=True,
|
||||
red_ratio_threshold=attend_button_threshold,
|
||||
analyser=analyser,
|
||||
),
|
||||
"has_fansclub_join_red": lambda pic: detect_fansclub_join_red_area(
|
||||
pic,
|
||||
return_info=True,
|
||||
red_ratio_threshold=fansclub_threshold,
|
||||
analyser=analyser,
|
||||
),
|
||||
"has_fudai_detail": lambda pic: detect_fudai_detail_page(
|
||||
pic,
|
||||
resolution_ratio_x,
|
||||
resolution_ratio_y,
|
||||
y_pianyi,
|
||||
fudai_template_threshold,
|
||||
return_info=True,
|
||||
analyser=analyser,
|
||||
),
|
||||
"has_live_room_pixel": _detect_live_room_pixel_wrapper, # 直播间图标像素检测(多边形区域白色像素检测)
|
||||
}
|
||||
|
||||
# 使用线程池并行执行检测(增加线程数以支持直播间图标检测)
|
||||
with ThreadPoolExecutor(max_workers=8) as executor:
|
||||
# 提交所有任务
|
||||
future_to_key = {
|
||||
executor.submit(detect_func, pic_rgb): key
|
||||
for key, detect_func in detection_tasks.items()
|
||||
}
|
||||
|
||||
# 收集结果
|
||||
for future in as_completed(future_to_key):
|
||||
key = future_to_key[future]
|
||||
try:
|
||||
result = future.result()
|
||||
|
||||
# 处理结果
|
||||
if isinstance(result, tuple):
|
||||
# 检测函数返回 (bool, dict) 格式
|
||||
is_detected, info = result
|
||||
state[key] = bool(is_detected)
|
||||
if return_details:
|
||||
details[key] = {
|
||||
"detected": bool(is_detected),
|
||||
"method": info.get("method", "unknown"),
|
||||
"template_score": info.get("template_score"),
|
||||
"confidence": info.get(
|
||||
"confidence"
|
||||
), # 添加confidence支持(用于像素检测)
|
||||
"task_count": info.get("task_count"), # 添加task_count支持
|
||||
"red_ratio": info.get("red_ratio"), # 添加red_ratio支持
|
||||
"effective_threshold": info.get("effective_threshold"),
|
||||
"reason": info.get("reason"),
|
||||
}
|
||||
else:
|
||||
# 其他检测返回 bool(不应该发生,因为所有检测都支持return_info)
|
||||
state[key] = bool(result)
|
||||
if return_details:
|
||||
details[key] = {
|
||||
"detected": bool(result),
|
||||
"method": "unknown",
|
||||
}
|
||||
except Exception as e: # type: ignore[general-exception]
|
||||
# 如果某个检测失败,保持默认值 False
|
||||
state[key] = False
|
||||
if return_details:
|
||||
details[key] = {
|
||||
"detected": False,
|
||||
"error": str(e),
|
||||
}
|
||||
|
||||
if return_details:
|
||||
return state, details
|
||||
return state
|
||||
@@ -201,6 +201,10 @@ def diagnose_stage_from_current_screen(analyser): # type: ignore[misc] # noqa:
|
||||
"检测方法": method,
|
||||
}
|
||||
|
||||
# 添加耗时信息
|
||||
if "elapsed_ms" in detail:
|
||||
log_fields["耗时(ms)"] = detail["elapsed_ms"]
|
||||
|
||||
# 添加分数信息
|
||||
if "template_score" in detail and detail["template_score"] is not None:
|
||||
log_fields["分数"] = round(detail["template_score"], 4)
|
||||
|
||||
+101
-37
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"updated_ts": 1767880922.4645042,
|
||||
"updated_ts": 1767883444.4458597,
|
||||
"reason": "reservation",
|
||||
"total": 117,
|
||||
"total": 121,
|
||||
"rooms": [
|
||||
{
|
||||
"first_seen_ts": 1765799932.458368,
|
||||
@@ -50,10 +50,10 @@
|
||||
},
|
||||
{
|
||||
"first_seen_ts": 1765978498.2618399,
|
||||
"last_seen_ts": 1767880760.5855446,
|
||||
"seen_count": 4,
|
||||
"pos_seen": 36,
|
||||
"pos_updated_ts": 1767880760.5855446,
|
||||
"last_seen_ts": 1767883313.9794135,
|
||||
"seen_count": 11,
|
||||
"pos_seen": 6,
|
||||
"pos_updated_ts": 1767883313.9794135,
|
||||
"room_title_raw_last": "小小101",
|
||||
"alias_raw": [
|
||||
"小小101"
|
||||
@@ -548,10 +548,10 @@
|
||||
},
|
||||
{
|
||||
"first_seen_ts": 1765736209.4437785,
|
||||
"last_seen_ts": 1767874436.4814007,
|
||||
"seen_count": 36,
|
||||
"pos_seen": 5,
|
||||
"pos_updated_ts": 1767874436.4814007,
|
||||
"last_seen_ts": 1767881955.1006455,
|
||||
"seen_count": 37,
|
||||
"pos_seen": 9,
|
||||
"pos_updated_ts": 1767881955.1006455,
|
||||
"room_title_raw_last": "梵象名品",
|
||||
"alias_raw": [
|
||||
"梵象名品...",
|
||||
@@ -1564,10 +1564,10 @@
|
||||
},
|
||||
{
|
||||
"first_seen_ts": 1767853118.7645984,
|
||||
"last_seen_ts": 1767880922.4645042,
|
||||
"seen_count": 17,
|
||||
"pos_seen": 6,
|
||||
"pos_updated_ts": 1767880922.4645042,
|
||||
"last_seen_ts": 1767881364.4998195,
|
||||
"seen_count": 18,
|
||||
"pos_seen": 7,
|
||||
"pos_updated_ts": 1767881364.4998195,
|
||||
"room_title_raw_last": "带娃的小。",
|
||||
"alias_raw": [
|
||||
"带娃的小。。",
|
||||
@@ -1597,10 +1597,10 @@
|
||||
},
|
||||
{
|
||||
"first_seen_ts": 1767853185.2990494,
|
||||
"last_seen_ts": 1767873676.0195742,
|
||||
"seen_count": 26,
|
||||
"pos_seen": 8,
|
||||
"pos_updated_ts": 1767873676.0195742,
|
||||
"last_seen_ts": 1767882793.2971323,
|
||||
"seen_count": 28,
|
||||
"pos_seen": 10,
|
||||
"pos_updated_ts": 1767882793.2971323,
|
||||
"room_title_raw_last": "作业帮数",
|
||||
"alias_raw": [
|
||||
"作业帮数"
|
||||
@@ -1646,10 +1646,10 @@
|
||||
},
|
||||
{
|
||||
"first_seen_ts": 1767856135.4817257,
|
||||
"last_seen_ts": 1767874037.5480306,
|
||||
"seen_count": 25,
|
||||
"pos_seen": 2,
|
||||
"pos_updated_ts": 1767874037.5480306,
|
||||
"last_seen_ts": 1767882434.3949316,
|
||||
"seen_count": 27,
|
||||
"pos_seen": 6,
|
||||
"pos_updated_ts": 1767882434.3949316,
|
||||
"room_title_raw_last": "六号折扣",
|
||||
"alias_raw": [
|
||||
"六号折扣"
|
||||
@@ -1872,10 +1872,10 @@
|
||||
},
|
||||
{
|
||||
"first_seen_ts": 1767866852.0270154,
|
||||
"last_seen_ts": 1767880809.9324286,
|
||||
"seen_count": 25,
|
||||
"last_seen_ts": 1767883417.6456714,
|
||||
"seen_count": 26,
|
||||
"pos_seen": 1,
|
||||
"pos_updated_ts": 1767880809.9324286,
|
||||
"pos_updated_ts": 1767883417.6456714,
|
||||
"room_title_raw_last": "琦儿",
|
||||
"alias_raw": [
|
||||
"琦儿"
|
||||
@@ -1969,10 +1969,10 @@
|
||||
},
|
||||
{
|
||||
"first_seen_ts": 1767874286.8196697,
|
||||
"last_seen_ts": 1767879470.5333042,
|
||||
"seen_count": 2,
|
||||
"pos_seen": 1,
|
||||
"pos_updated_ts": 1767879470.5333042,
|
||||
"last_seen_ts": 1767881481.8102894,
|
||||
"seen_count": 3,
|
||||
"pos_seen": 4,
|
||||
"pos_updated_ts": 1767881481.8102894,
|
||||
"room_title_raw_last": "'琦川",
|
||||
"alias_raw": [
|
||||
"琦川",
|
||||
@@ -1986,10 +1986,10 @@
|
||||
},
|
||||
{
|
||||
"first_seen_ts": 1767879443.0748515,
|
||||
"last_seen_ts": 1767879443.0748515,
|
||||
"seen_count": 1,
|
||||
"pos_seen": 0,
|
||||
"pos_updated_ts": 1767879443.0748515,
|
||||
"last_seen_ts": 1767883444.4458597,
|
||||
"seen_count": 3,
|
||||
"pos_seen": 1,
|
||||
"pos_updated_ts": 1767883444.4458597,
|
||||
"room_title_raw_last": "一枯梅旁",
|
||||
"alias_raw": [
|
||||
"一枯梅旁"
|
||||
@@ -2002,10 +2002,10 @@
|
||||
},
|
||||
{
|
||||
"first_seen_ts": 1767879687.7186654,
|
||||
"last_seen_ts": 1767880850.5321994,
|
||||
"seen_count": 2,
|
||||
"pos_seen": 3,
|
||||
"pos_updated_ts": 1767880850.5321994,
|
||||
"last_seen_ts": 1767881148.3525774,
|
||||
"seen_count": 3,
|
||||
"pos_seen": 4,
|
||||
"pos_updated_ts": 1767881148.3525774,
|
||||
"room_title_raw_last": "一枯梅雾",
|
||||
"alias_raw": [
|
||||
"一枯梅雾"
|
||||
@@ -2031,6 +2031,70 @@
|
||||
"last_prize_value_yuan": 1399.0,
|
||||
"max_prize_value_yuan": 1399.0,
|
||||
"room_title": "麦小骛89"
|
||||
},
|
||||
{
|
||||
"first_seen_ts": 1767881514.9308615,
|
||||
"last_seen_ts": 1767881514.9308615,
|
||||
"seen_count": 1,
|
||||
"pos_seen": 0,
|
||||
"pos_updated_ts": 1767881514.9308615,
|
||||
"room_title_raw_last": "枯梅旁",
|
||||
"alias_raw": [
|
||||
"枯梅旁"
|
||||
],
|
||||
"key_kind": "norm",
|
||||
"last_content": "",
|
||||
"last_prize_value_yuan": 999.0,
|
||||
"max_prize_value_yuan": 999.0,
|
||||
"room_title": "枯梅旁"
|
||||
},
|
||||
{
|
||||
"first_seen_ts": 1767881558.8455567,
|
||||
"last_seen_ts": 1767882476.7702558,
|
||||
"seen_count": 4,
|
||||
"pos_seen": 8,
|
||||
"pos_updated_ts": 1767882476.7702558,
|
||||
"room_title_raw_last": "云舍花卉",
|
||||
"alias_raw": [
|
||||
"云舍花卉"
|
||||
],
|
||||
"key_kind": "norm",
|
||||
"last_content": "",
|
||||
"last_prize_value_yuan": 899.0,
|
||||
"max_prize_value_yuan": 899.0,
|
||||
"room_title": "云舍花卉"
|
||||
},
|
||||
{
|
||||
"first_seen_ts": 1767881878.4492779,
|
||||
"last_seen_ts": 1767883171.3186133,
|
||||
"seen_count": 2,
|
||||
"pos_seen": 4,
|
||||
"pos_updated_ts": 1767883171.3186133,
|
||||
"room_title_raw_last": "几里与麻",
|
||||
"alias_raw": [
|
||||
"几里与麻"
|
||||
],
|
||||
"key_kind": "norm",
|
||||
"last_content": "",
|
||||
"last_prize_value_yuan": 5999.0,
|
||||
"max_prize_value_yuan": 35999.0,
|
||||
"room_title": "几里与麻"
|
||||
},
|
||||
{
|
||||
"first_seen_ts": 1767882965.3330166,
|
||||
"last_seen_ts": 1767883129.6050637,
|
||||
"seen_count": 2,
|
||||
"pos_seen": 2,
|
||||
"pos_updated_ts": 1767883129.6050637,
|
||||
"room_title_raw_last": "小肉包",
|
||||
"alias_raw": [
|
||||
"小肉包"
|
||||
],
|
||||
"key_kind": "norm",
|
||||
"last_content": "",
|
||||
"last_prize_value_yuan": 28588.0,
|
||||
"max_prize_value_yuan": 28588.0,
|
||||
"room_title": "小肉包"
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in new issue
Block a user