补回上次合并丢失的关键路径修复 + .gitignore 补强 + 依赖版本对齐
上次冲突解决时跳过了 982f57e (P0 清理) 和 b6ae970 (路径修复) 两个 commit,
本提交补回其中影响运行时正确性和文档一致性的 7 处。
E. 路径错位修复
- douyin/core/douyin_fudai.py: _reservations_state_path 与 room_pos_map
状态目录改为优先调用 path_config.get_reservations_path()
- douyin/core/path_config.py: get_reservations_path 注释明确"实际位置 + 写入方"
- gui/components/mapping_utils.py: 删除错误兜底 douyin/state/reservations.json
- gui/components/mapping_table.py: 同步删除 douyin/state/room_pos_map.json 错误兜底
- gui/web_gui.py: get_reservations() 内的兜底由 douyin/state/ 修正为 douyin/core/state/
- bin/run_cli.py: 移除对已删空文件 douyin_reservation_ops.py 的 shim 加载
- douyin/reservation/douyin_reservation_ops.py: 删除 0 字节空文件
F. .gitignore 补强
- 新增 *.bak_* 拦截带日期后缀的备份命名(修复 *.bak 命中失败的场景)
G. 依赖版本对齐
- requirements-minimal.txt: paddleocr/paddlepaddle 改为 >=3.0.0,与 requirements.txt 一致
- README.md: 安装指引中 paddlepaddle==2.5.2 改为 >=3.0.0
回归:全量 .py compileall 通过;7 项断言(path_config 路径、douyin_fudai 切换、
3 处兜底已清、shim 已移除、空文件已删、.gitignore 补强、版本对齐)全部 PASS;
test_filter_logging / check_web_gui_config_sync 通过。
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
1 parent
0a0b59c908
commit
71f3653354
10 files changed
+25
-18
No files matched your search
@@ -85,6 +85,7 @@ temp/
|
||||
config/*.json
|
||||
!config/README.md
|
||||
*.bak
|
||||
*.bak_*
|
||||
*.backup
|
||||
*.orig
|
||||
*.swp
|
||||
|
||||
@@ -399,10 +399,10 @@ pip install pillow paddlepaddle paddleocr numpy opencv-python
|
||||
|
||||
# 如果 paddlepaddle 安装失败,可以尝试:
|
||||
# CPU 版本(推荐)
|
||||
pip install paddlepaddle==2.5.2 -i https://pypi.tuna.tsinghua.edu.cn/simple
|
||||
pip install "paddlepaddle>=3.0.0" -i https://pypi.tuna.tsinghua.edu.cn/simple
|
||||
|
||||
# 或 GPU 版本(需要 CUDA)
|
||||
pip install paddlepaddle-gpu==2.5.2 -i https://pypi.tuna.tsinghua.edu.cn/simple
|
||||
pip install "paddlepaddle-gpu>=3.0.0" -i https://pypi.tuna.tsinghua.edu.cn/simple
|
||||
|
||||
# 安装 GUI 依赖(可选)
|
||||
pip install ttkbootstrap
|
||||
|
||||
@@ -77,9 +77,6 @@ def _load_local_shim(mod_name: str, rel_path: str) -> None:
|
||||
# 1) 先加载本地 shim 模块,确保后续 import 优先使用这些实现
|
||||
_load_local_shim("douyin_text_utils", "douyin/utils/douyin_text_utils.py")
|
||||
_load_local_shim("douyin_swipe_ops", "douyin/handlers/douyin_swipe_ops.py")
|
||||
_load_local_shim(
|
||||
"douyin_reservation_ops", "douyin/reservation/douyin_reservation_ops.py"
|
||||
)
|
||||
|
||||
# 2) 再把完整逻辑所在目录追加到 sys.path,供 `douyin_fudai` 等模块导入
|
||||
try:
|
||||
|
||||
@@ -291,9 +291,13 @@ class fudai_analyse:
|
||||
self.queue_full_waiting_at_earliest: bool = False
|
||||
|
||||
# 预约队列状态文件(供 WebGUI / 其他进程查看)
|
||||
self._reservations_state_path: str = os.path.join(
|
||||
os.path.dirname(__file__), "state", "reservations.json"
|
||||
)
|
||||
try:
|
||||
from douyin.core import path_config as _pc
|
||||
self._reservations_state_path: str = _pc.get_reservations_path()
|
||||
except Exception:
|
||||
self._reservations_state_path = os.path.join(
|
||||
os.path.dirname(__file__), "state", "reservations.json"
|
||||
)
|
||||
|
||||
# 运行时直播间标题和位置映射表(用于回退校验)
|
||||
# 格式:{room_pos: {"title": str, "title_raw": str, "has_fudai": bool, "fudai_content": str, "fudai_detail": Any}}
|
||||
@@ -301,7 +305,7 @@ class fudai_analyse:
|
||||
# 每次重新运行时丢弃磁盘上旧的映射表,确保只记录本次运行的结果。
|
||||
# 同时尝试删除旧的导出文件(JSON/CSV/MD),以避免 GUI 在未写入新数据前显示过期内容。
|
||||
try:
|
||||
state_dir = os.path.join(os.path.dirname(__file__), "state")
|
||||
state_dir = os.path.dirname(self._reservations_state_path)
|
||||
state_path = os.path.join(state_dir, "room_pos_map.json")
|
||||
csv_path = os.path.join(state_dir, "room_pos_map.csv")
|
||||
md_path = os.path.join(state_dir, "room_pos_map.md")
|
||||
|
||||
@@ -61,7 +61,11 @@ def get_state_dir() -> str:
|
||||
|
||||
|
||||
def get_reservations_path() -> str:
|
||||
"""返回预约队列状态文件的路径(实际位置在douyin/core/state/reservations.json)"""
|
||||
"""返回预约队列状态文件的路径(实际位置:douyin/core/state/reservations.json)。
|
||||
|
||||
该文件由 fudai_analyse 在 douyin/core/douyin_fudai.py 中写入,
|
||||
供 WebGUI / 桌面 GUI 跨进程读取。
|
||||
"""
|
||||
return os.path.join(PROJECT_ROOT, "douyin", "core", "state", "reservations.json")
|
||||
|
||||
|
||||
|
||||
Whitespace-only changes.
@@ -191,7 +191,6 @@ def create_mapping_tab(root: tk.Tk, notebook: ttk.Notebook, cfg: dict) -> ttk.Fr
|
||||
possible_paths = [
|
||||
os.path.join(base_dir, "douyin", "core", "state", "room_pos_map.json"),
|
||||
os.path.join(base_dir, "douyin", "core", "state", "reservations.json"),
|
||||
os.path.join(base_dir, "douyin", "state", "room_pos_map.json"),
|
||||
os.path.join(os.getcwd(), "douyin", "core", "state", "room_pos_map.json"),
|
||||
]
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@ def load_reservations(base_dir: str | None = None) -> Dict[int, Any]:
|
||||
reservations_data: Dict[int, Any] = {}
|
||||
reservations_paths = [
|
||||
os.path.join(base_dir, "douyin", "core", "state", "reservations.json"),
|
||||
os.path.join(base_dir, "douyin", "state", "reservations.json"),
|
||||
os.path.join(os.getcwd(), "douyin", "core", "state", "reservations.json"),
|
||||
]
|
||||
for res_path in reservations_paths:
|
||||
|
||||
+4
-1
@@ -985,11 +985,14 @@ class ProcRunner:
|
||||
else os.getcwd()
|
||||
),
|
||||
"douyin",
|
||||
"core",
|
||||
"state",
|
||||
"reservations.json",
|
||||
)
|
||||
else:
|
||||
path = os.path.join(os.getcwd(), "douyin", "state", "reservations.json")
|
||||
path = os.path.join(
|
||||
os.getcwd(), "douyin", "core", "state", "reservations.json"
|
||||
)
|
||||
try:
|
||||
if os.path.exists(path):
|
||||
with open(path, "r", encoding="utf-8") as f:
|
||||
|
||||
@@ -11,12 +11,12 @@ numpy>=1.20.0
|
||||
# 计算机视觉库
|
||||
opencv-python>=4.5.0
|
||||
|
||||
# OCR识别 - 只需一个OCR引擎即可
|
||||
# 选项1: PaddleOCR(推荐,中文识别效果好)
|
||||
paddleocr>=2.7.0
|
||||
paddlepaddle>=2.5.0,<3.0.0
|
||||
# OCR识别(与 requirements.txt 保持一致)
|
||||
# PaddleOCR 3.0+ 需要 PaddlePaddle 3.0+
|
||||
paddleocr>=3.0.0
|
||||
paddlepaddle>=3.0.0
|
||||
|
||||
# 选项2: EasyOCR(更快,但识别准确度可能略低)
|
||||
# 选项2:EasyOCR(更快,但识别准确度可能略低)
|
||||
# easyocr>=1.7.0
|
||||
|
||||
# GUI依赖(可选)
|
||||
|
||||
Reference in new issue
Block a user