feat: expose fudai region coordinates in gui

This commit is contained in:
Your Name committed 2026-06-03 20:29:10 +08:00
1 parent bcc4d1151f
commit 4797fa046e
17 files changed
+1044 -119

No files matched your search

@@ -106,6 +106,43 @@ HELPER_CONFIG_KEYS = {
"logging.performance_tracking.track_function_calls",
}
REGION_CONFIG_KEYS = {
"fudai_detail_regions.legacy.content",
"fudai_detail_regions.legacy.value",
"fudai_detail_regions.legacy.countdown_full",
"fudai_detail_regions.legacy.task_list",
"fudai_detail_regions.legacy.task_count",
"fudai_detail_regions.legacy.participants",
"fudai_detail_regions.legacy.button",
"fudai_detail_regions.legacy.live_title",
"fudai_detail_regions.v2_0_two_task.content",
"fudai_detail_regions.v2_0_two_task.value",
"fudai_detail_regions.v2_0_two_task.countdown_full",
"fudai_detail_regions.v2_0_two_task.task_list",
"fudai_detail_regions.v2_0_two_task.task_count",
"fudai_detail_regions.v2_0_two_task.participants",
"fudai_detail_regions.v2_0_two_task.button",
"fudai_detail_regions.v2_0_two_task.live_title",
"fudai_detail_regions.v2_0_one_task.content",
"fudai_detail_regions.v2_0_one_task.value",
"fudai_detail_regions.v2_0_one_task.countdown_full",
"fudai_detail_regions.v2_0_one_task.info_line",
"fudai_detail_regions.v2_0_one_task.task_list",
"fudai_detail_regions.v2_0_one_task.task_count",
"fudai_detail_regions.v2_0_one_task.participants",
"fudai_detail_regions.v2_0_one_task.button",
"fudai_detail_regions.v2_0_one_task.live_title",
"pixel_regions.lottery_result.button",
"pixel_regions.lottery_result.pixel",
"pixel_regions.lottery_result.click",
"pixel_regions.attend_button",
"pixel_regions.fansclub_join",
"pixel_regions.coupon_popup",
"pixel_regions.shopping_redpacket",
"pixel_regions.fudai_detail_body",
"pixel_regions.live_room_icon_bbox",
}
def _read(path: Path) -> str:
return path.read_text(encoding="utf-8", errors="ignore")
@@ -131,6 +168,8 @@ def extract_gui_saved_keys(source: str) -> set[str]:
keys.update(FUDAI_DETAIL_OCR_KEYS)
if "pixel_detect_fudai_icon_enabled" in block:
keys.update(DETECTION_SWITCH_KEYS)
if "fudai_detail_regions" in block or "pixel_regions" in block:
keys.update(REGION_CONFIG_KEYS)
return keys
@@ -161,12 +200,17 @@ def extract_gui_loaded_keys(source: str) -> set[str]:
keys.update(FUDAI_DETAIL_OCR_KEYS)
if "pixel_detect_fudai_icon_enabled" in block:
keys.update(DETECTION_SWITCH_KEYS)
if "fudai_detail_regions" in block or "pixel_regions" in block:
keys.update(REGION_CONFIG_KEYS)
return {key for key in keys if key not in IGNORED_CONTAINER_KEYS}
def extract_web_keys(source: str) -> set[str]:
keys = set(re.findall(r'data-key="([^"]+)"', source))
keys.update(re.findall(r'data-mirror-key="([^"]+)"', source))
keys = {key for key in keys if "${" not in key}
if "fudai_detail_regions" in source or "pixel_regions" in source:
keys.update(REGION_CONFIG_KEYS)
return keys
@@ -182,6 +226,9 @@ def build_manifest() -> dict[str, object]:
gui_loaded = extract_gui_loaded_keys(
config_io_source + "\n" + config_io_helpers_source + "\n" + gui_source + "\n" + realtime_tab_source
)
if "_REGION_CONFIG_SPECS" in config_io_source:
gui_saved.update(REGION_CONFIG_KEYS)
gui_loaded.update(REGION_CONFIG_KEYS)
gui_saved.update(HELPER_CONFIG_KEYS)
gui_loaded.update(HELPER_CONFIG_KEYS)
web_keys = extract_web_keys(web_source)