refactor: 合并 fudai_detail_modules/ 到 douyin/fudai/core/
将 fudai_detail_modules/ 6 个模块全部迁移到 douyin/fudai/core/: - fudai_detail_coupon_detection.py - fudai_detail_operations.py - fudai_detail_room_title.py - fudai_detail_utils.py - fudai_detail_validator.py - fudai_detail_reader.py -> fudai_detail_orchestrator.py(避免与 core/ 已有同名文件冲突) 更新所有 import: - douyin/fudai/douyin_fudai_core.py - douyin/fudai/douyin_fudai_detail.py 删除 fudai_detail_modules/ 空目录及其 README/__init__。 验证:python -m compileall 全项目通过。 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
cb4d25abdf
commit
b137aead48
11 files changed
+8
-64
No files matched your search
File renamed without changes.
File renamed without changes.
+1
-1
@@ -14,7 +14,7 @@ import time
|
||||
from PIL import Image
|
||||
|
||||
from douyin.fudai.douyin_fudai_core import get_fudai_contain
|
||||
from .fudai_detail_validator import validate_fudai_detail
|
||||
from douyin.fudai.core.fudai_detail_validator import validate_fudai_detail
|
||||
|
||||
|
||||
def read_fudai_detail_once(analyser: Any) -> Tuple[str, Tuple, dict]:
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -982,7 +982,7 @@ def get_fudai_contain(analyser, renwu: int = 2) -> Tuple[str, str, int, int, flo
|
||||
start = time.time()
|
||||
try:
|
||||
# 导入直播间标题识别函数
|
||||
from fudai_detail_modules.fudai_detail_room_title import _ocr_try_room_title
|
||||
from douyin.fudai.core.fudai_detail_room_title import _ocr_try_room_title
|
||||
|
||||
# 使用已切割的图片进行OCR识别
|
||||
title, raw_text = _ocr_try_room_title(analyser, "live_room_title_mid", 0)
|
||||
|
||||
@@ -16,29 +16,29 @@ Exports:
|
||||
"""
|
||||
|
||||
# 从各子模块导入所有公共API
|
||||
from fudai_detail_modules.fudai_detail_operations import (
|
||||
from douyin.fudai.core.fudai_detail_operations import (
|
||||
close_fudai_detail,
|
||||
ensure_fudai_detail_open,
|
||||
)
|
||||
|
||||
from fudai_detail_modules.fudai_detail_room_title import (
|
||||
from douyin.fudai.core.fudai_detail_room_title import (
|
||||
read_live_room_title_core,
|
||||
)
|
||||
|
||||
from fudai_detail_modules.fudai_detail_reader import (
|
||||
from douyin.fudai.core.fudai_detail_orchestrator import (
|
||||
read_fudai_detail_once,
|
||||
read_fudai_detail_with_retries,
|
||||
)
|
||||
|
||||
from fudai_detail_modules.fudai_detail_validator import (
|
||||
from douyin.fudai.core.fudai_detail_validator import (
|
||||
validate_fudai_detail,
|
||||
)
|
||||
|
||||
from fudai_detail_modules.fudai_detail_utils import (
|
||||
from douyin.fudai.core.fudai_detail_utils import (
|
||||
is_abnormal_time_value,
|
||||
)
|
||||
|
||||
from fudai_detail_modules.fudai_detail_coupon_detection import (
|
||||
from douyin.fudai.core.fudai_detail_coupon_detection import (
|
||||
is_wrong_coupon_popup,
|
||||
)
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
集中化以前散落在多个文件的重复实现:
|
||||
- douyin/fudai/douyin_fudai_core.py: _parse_mm_ss
|
||||
- douyin/fudai/core/fudai_detail_reader.py: _parse_mm_ss
|
||||
- fudai_detail_modules/fudai_detail_reader.py: _parse_mm_ss
|
||||
|
||||
注意:normalize_countdown_text 仍在 douyin/utils/douyin_utils.py 中,
|
||||
那里逻辑更复杂(包含 OCR 字符纠正等),不在此处重复。
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
# 福袋详情模块目录
|
||||
|
||||
本目录包含 `douyin_fudai_detail.py` 的模块化子模块。
|
||||
|
||||
## 文件结构
|
||||
|
||||
- `fudai_detail_room_title.py` - 直播间标题处理模块
|
||||
- `fudai_detail_operations.py` - 福袋详情页操作模块(打开/关闭)
|
||||
- `fudai_detail_coupon_detection.py` - 优惠券弹窗检测模块
|
||||
- `fudai_detail_reader.py` - 福袋详情读取模块
|
||||
- `fudai_detail_validator.py` - 数据验证模块
|
||||
- `fudai_detail_utils.py` - 工具函数模块
|
||||
- `__init__.py` - 包初始化文件
|
||||
|
||||
## 使用方式
|
||||
|
||||
所有功能通过主模块 `douyin_fudai_detail` 导出,使用方式保持不变:
|
||||
|
||||
```python
|
||||
import douyin_fudai_detail
|
||||
|
||||
# 使用导出的函数
|
||||
douyin_fudai_detail.close_fudai_detail(analyser)
|
||||
douyin_fudai_detail.read_fudai_detail_once(analyser)
|
||||
# ... 等等
|
||||
```
|
||||
|
||||
## 模块说明
|
||||
|
||||
### fudai_detail_room_title.py
|
||||
处理直播间标题的OCR识别、噪音过滤、规范化等功能。
|
||||
|
||||
### fudai_detail_operations.py
|
||||
处理福袋详情页的打开和关闭操作。
|
||||
|
||||
### fudai_detail_coupon_detection.py
|
||||
检测当前弹窗是否为优惠券弹窗,而非真正的福袋详情页。
|
||||
|
||||
### fudai_detail_reader.py
|
||||
执行福袋详情的OCR识别和读取,包括单次读取和重试读取。
|
||||
|
||||
### fudai_detail_validator.py
|
||||
验证福袋详情数据的合理性,检测识别错误。
|
||||
|
||||
### fudai_detail_utils.py
|
||||
提供通用的工具函数。
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
"""
|
||||
福袋详情模块包
|
||||
==============
|
||||
|
||||
包含所有福袋详情相关的子模块。
|
||||
"""
|
||||
|
||||
__all__ = []
|
||||
Reference in new issue
Block a user