把 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>
41 lines
1.2 KiB
Python
41 lines
1.2 KiB
Python
"""pixel - 像素 / 模板匹配检测子包。
|
|
|
|
原 douyin/detection/douyin_pixel.py 拆成 4 个子模块:
|
|
|
|
- _common 共享:_safe_open_screenshot_rgb
|
|
- popups 弹窗类检测:优惠券 / 红包 / 抽奖结果
|
|
- buttons 按钮区域红色检测:参与按钮 / 粉丝团加入
|
|
- stage 阶段诊断:直播间图标 / 福袋详情页 / 综合阶段状态读取
|
|
|
|
外部 import 路径不变:
|
|
``from douyin.detection.douyin_pixel import detect_fudai_detail_page`` 仍可用。
|
|
"""
|
|
|
|
from ._common import _safe_open_screenshot_rgb
|
|
from .popups import (
|
|
detect_coupon_popup_background,
|
|
detect_redpacket_popup_background,
|
|
detect_lucky_draw_result_popup,
|
|
)
|
|
from .buttons import (
|
|
detect_attend_button_red_area,
|
|
detect_fansclub_join_red_area,
|
|
)
|
|
from .stage import (
|
|
detect_live_room_icons_by_pixel,
|
|
detect_fudai_detail_page,
|
|
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",
|
|
]
|