Files
douyin_guaji-main/douyin/detection/douyin_pixel.py
T
CodexandClaude Opus 4.7 c0b8ff3ba6 拆分 douyin_pixel (1172 → 4 个子模块 + 33 行 shim)
把 douyin/detection/douyin_pixel.py 按职责拆成
douyin/detection/pixel/ 子包:

- _common (32)     _safe_open_screenshot_rgb
- popups (444)     优惠券 / 红包 / 抽奖结果弹窗检测
- buttons (340)    参与按钮 / 粉丝团加入红色区域检测
- stage (436)      直播间图标 / 福袋详情 / 综合阶段状态读取

原文件改为 33 行 re-export shim,9 个公共符号全部保留。
detect_fudai_detail_page 等 6 处外部引用、detect_attend_button_red_area
等 2 处外部引用全部不需修改。

回归:
- 5 个新文件 + shim compileall 通过
- pytest 353 passed / 1 skipped
- 旧 import 路径与新子包路径返回同一函数对象

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-21 16:37:06 +08:00

34 lines
1.2 KiB
Python

"""douyin_pixel - 兼容入口(保留外部 import 路径)。
实际实现位于子包 ``douyin.detection.pixel``。
本文件仅 re-export 公共符号;详见各子模块文档:
- ``pixel._common`` 共享 _safe_open_screenshot_rgb
- ``pixel.popups`` 弹窗类检测(优惠券 / 红包 / 抽奖结果)
- ``pixel.buttons`` 按钮区域红色检测(参与按钮 / 粉丝团加入)
- ``pixel.stage`` 阶段诊断(直播间图标 / 福袋详情 / 综合状态读取)
"""
from douyin.detection.pixel import (
_safe_open_screenshot_rgb,
detect_attend_button_red_area,
detect_coupon_popup_background,
detect_fansclub_join_red_area,
detect_fudai_detail_page,
detect_live_room_icons_by_pixel,
detect_lucky_draw_result_popup,
detect_redpacket_popup_background,
read_pixel_stage_state_from_screenshot,
)
__all__ = [
"_safe_open_screenshot_rgb",
"detect_coupon_popup_background",
"detect_redpacket_popup_background",
"detect_lucky_draw_result_popup",
"detect_attend_button_red_area",
"detect_fansclub_join_red_area",
"detect_live_room_icons_by_pixel",
"detect_fudai_detail_page",
"read_pixel_stage_state_from_screenshot",
]