 CodexandClaude Opus 4.7
|
b6cd3ac8a3
|
refactor(fudai): 拆出 _handle_in_fudai_detail 详情为None早返回(3687→3663,-24 行)
handle_detail_is_none:detail==None 时清除任务数量标志 + 写完成日志 + 早返回。
新增 3 个单元测试,1068 → 1071 用例全过。
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
2026-05-22 02:15:30 +08:00 |
|
 CodexandClaude Opus 4.7
|
18c6f7b025
|
refactor(fudai): 拆出 _handle_in_fudai_detail 失败计数子块(3732→3687,-45 行)
把 _handle_in_fudai_detail 中连续参与失败次数过多的早返回块抽到
fudai_detail_blocks.handle_too_many_consecutive_failures:
- 检查 _consecutive_attend_failures 是否超阈值
- 关闭详情页 → 按 needswitch 决定切换 → 重置计数器
- 返回 True 让主流程 return
新增 5 个单元测试覆盖阈值边界 / 切换开关 / 异常兜底,1063 → 1068 用例全过。
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
2026-05-22 02:11:44 +08:00 |
|
 CodexandClaude Opus 4.7
|
c7c6c51d20
|
refactor(reservation): 拆出 attend_window 计算+日志辅助(1437→1375,-62 行)
process_reservation_attend_window 中两个互不依赖的子块抽到 attend_window_helpers:
- compute_dynamic_ahead:根据回退步数 + 单步延迟动态计算提前进入参与窗口秒数(纯函数)
- log_attend_window_check_details:输出锁定期 / 时间窗口诊断结构化日志
新增 13 个单元测试覆盖各种边界(零步 / 截断 / 大延迟 / 异常兜底 / 锁定期内外)。
1050 → 1063 用例全过。
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
2026-05-22 02:08:11 +08:00 |
|
 CodexandClaude Opus 4.7
|
189d24255d
|
refactor(stage): 拆出 douyin_stage 日志格式化辅助(1385→1284,-101 行)
diagnose_stage_from_current_screen 中并行检测后的详细日志记录块(108 行)
是纯日志格式化逻辑,依赖 pixel_state / pixel_details,不修改业务状态。
拆到 douyin_stage_helpers:
- _format_detail_log_fields:单 detail 字典 → 日志字段映射
- log_pixel_detection_details:遍历 pixel_details 写日志(含 has_fudai_detail
的 task_count 矛盾告警)
- summarize_pixel_state:pixel_state 摘要写一行日志
新增 12 个单元测试覆盖纯函数行为,1038 → 1050 用例全过。
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
2026-05-22 02:04:10 +08:00 |
|
 CodexandClaude Opus 4.7
|
20e48d6a51
|
refactor(fudai): 拆出粉丝团门槛分支到独立模块(1629→577,-1052 行)
attend_choujiang 中加入粉丝团门槛分支占了 1057 行(520-1576),
内含 OCR 识别按钮位置 + 多次点击 + 详情页恢复递归等复杂逻辑。
该分支只依赖 analyser 和 attend_button_text 两个参数,自包含性强。
整段提取到 douyin/fudai/core/fudai_attend_fansclub.handle_fansclub_branch,
原方法只剩 elif 调用。粉丝团模块本身是 1075 行,但与其他分支解耦后
未来可针对粉丝团逻辑做独立优化、独立测试。
冒烟测试覆盖 import + 签名 + 公开 API,1034 → 1038 用例全过。
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
2026-05-22 01:59:09 +08:00 |
|
 CodexandClaude Opus 4.7
|
9c1540b3ea
|
refactor(detection): 删除 finder.py 中 502 行不可达死代码
check_have_fudai_with_ready_screenshot 在 936 行 `return False` 之后
仍有 938-1431 行的旧像素检测代码残留,由 AST 静态分析确认完全不可达
(早期重构时只加了新逻辑、没删旧逻辑造成的)。
仅删除死代码,无逻辑变更,1026 用例全过。
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
2026-05-22 01:46:08 +08:00 |
|
 CodexandClaude Opus 4.7
|
0bdc378252
|
refactor(fudai): 拆出 run_once_basic 4 个独立子块(4121→3732,-389 行)
把 run_once_basic 中互相独立的 4 个块抽到 fudai_run_blocks:
- handle_waiting_for_lottery_result(等待开奖期间的持续 OCR 检测)
- handle_no_attend_timeout(30 分钟未参与超时回到推荐页)
- handle_desktop_recovery(误返回桌面后的自救路径)
- handle_high_value_room_revisit(高价值房间重访检查)
每个函数返回 bool:True=主流程应 return,False=继续下一阶段。
原方法只剩调用 + 早返回,可读性大幅提升。
新增 13 个单元测试覆盖 4 个块的核心分支,1013 → 1026 用例全过。
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
2026-05-22 01:40:23 +08:00 |
|
 CodexandClaude Opus 4.7
|
af8145b8a8
|
补 fudai_filter_pkg / logging_pkg 单元测试 + 修 monitor 缺 datetime import
新增测试:
- test_fudai_filter_pkg (24)
覆盖 helpers / should_skip / join_decision 三个子模块
含 _is_short_countdown_text / is_watch_task_fudai / check_contain
+ should_skip_fudai_by_config 5 个业务场景断言(高价值通过 / 观看任务跳过 /
低价值跳过 / 黑名单跳过 / 单间模式必参)
- test_logging_pkg (22)
覆盖 _common 全局状态 + handlers 类构造 + cleanup 纯函数边界 + monitor
类构造 + config 全部对外 API(get_logger 缓存 / get_caller_info /
format_exception_info / LogContext / log_function_call 装饰器)
修复 1 个真实回归 bug:
- douyin/logging/douyin_logging_pkg/monitor.py 缺 from datetime import datetime
(原文件用的是 from datetime import datetime, timedelta;拆分时只写了
import 模块导致 datetime.now() 抛 NameError)
修复后 LogRotationMonitor 可正常构造
回归:
- 全套 581 → 627 (+46 用例)
- 全部 627 passed in 22s
- compileall exit 0
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
2026-05-21 21:01:15 +08:00 |
|
 CodexandClaude Opus 4.7
|
2d928c3856
|
FudaiDetector.detect_by_template 拆出(957→655,瘦身 302 行)
把 douyin/fudai/douyin_fudai_finder_pkg/detector.py 的 FudaiDetector.detect_by_template
(306 行 / 4 个 self.X)搬到独立子模块 detect_by_template.py(321 行)。
策略:
- self.analyser → analyser(参数)
- self.rx → rx(参数)
- 类方法保留为 1 行 forwarding:
def detect_by_template(self, pic, region):
return _impl(self.analyser, self.rx, pic, region)
- detector.py 内顶部 import detect_by_template 模块的实现
回归:
- 2 个文件 compileall 通过
- pytest 355 passed / 1 skipped
- FudaiFinder() 实例化正常,FudaiDetector.detect_by_template 类方法仍可访问
- module-level detect_by_template 可独立调用
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
2026-05-21 20:31:27 +08:00 |
|
 CodexandClaude Opus 4.7
|
57d99f3459
|
拆分 douyin_fudai_core (2205 → 2124 + 3 个子模块)
把 douyin/fudai/douyin_fudai_core.py 中工具/兼容部分搬到
douyin/fudai/douyin_fudai_core_pkg/ 子包:
- ocr_executor (46) _FudaiOcrExecutorState 类 + _fudai_ocr_executor_state
全局实例 + _get_fudai_ocr_executor 池复用函数
- thin_wrappers (65) 11 个 [兼容] 薄壳 forwarding 函数
(attend_choujiang / check_lucky_draw_result /
is_watch_task_fudai / should_skip_fudai_by_config /
basic_join_decision 等)
巨型 get_fudai_contain (2062 行) 留在原文件。原文件从子包 import 后
re-export,外部全部不需修改:
- should_skip_fudai_by_config 24 处外部引用
- attend_choujiang 15 处 / is_watch_task_fudai 13 处 / basic_join_decision 13 处
- 其他 1-10 处
回归:
- 4 个新/改文件 compileall 通过
- pytest 355 passed / 1 skipped(其中 2 个新 _is_short_countdown_text 测试也通过)
- attend_choujiang shim ⇄ pkg 同一对象
- should_skip_fudai_by_config(高价值) 返回 (False, 'ok')
- _fudai_ocr_executor_state.workers = 0 全局实例正常
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
2026-05-21 20:25:34 +08:00 |
|
 CodexandClaude Opus 4.7
|
a337b4b93d
|
underlying_operations 第三轮拆分(2434 → 2351,再瘦身 83 行)
新增 2 个子模块:
- device_select (新, 73) select_device 设备选择交互(无 self.X)
- ocr_digits (新, 49) analyse_pic_digits 数字 OCR 识别
(保留 analyser 参数以调 analyser.analyse_pic_word)
策略:
- select_device 的 self.X 全是 _adb_path / _adb_args,已经是 module-level,
搬出后改用 from .adb_helpers import _adb_path, _adb_args 即可。
- analyse_pic_digits 用 self.analyse_pic_word(递归调用类内大方法)。
搬到 module-level 后第一参数从 self 改名 analyser,类内 forwarding
传 self 即可,外部 op.analyse_pic_digits(picname) 完全兼容。
回归:
- 4 个新/改文件 compileall 通过
- pytest 353 passed / 1 skipped
- underlying_operations.select_device / analyse_pic_digits 类方法和 module-level
函数都可访问
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
2026-05-21 20:12:40 +08:00 |
|
 CodexandClaude Opus 4.7
|
57eacb3219
|
underlying_operations 第二轮拆分(2582 → 2434,再瘦身 148 行)
新增 3 个子模块 + 1 个函数搬到已有子模块:
- adb_helpers (38) 新增 _adb_args(构造 adb -s 命令行)
- reward_pic (新, 73) save_reward_pic(中奖截图保存)
- swipe_sendevent (新, 47) _swipe_with_sendevent_improved(sendevent 滑动)
- clipboard (新, 75) set_clipboard_text(设备剪贴板设置)
策略:4 个方法的 self.X 引用都是 self._adb_path / self._adb_args 这种
"无状态工具方法",可以替换为 module-level 函数调用。类内方法保留为
1 行 forwarding 调用 _impl_X。
外部调用全部不需修改:
- save_reward_pic 4 处外部 self.save_reward_pic 仍工作
- _adb_args / _swipe_with_sendevent_improved / set_clipboard_text 0 外部引用
回归:
- 5 个新/改文件 compileall 通过
- pytest 353 passed / 1 skipped
- 类的 _adb_args / save_reward_pic / set_clipboard_text /
_swipe_with_sendevent_improved 4 个 forwarding 全部正确
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
2026-05-21 20:07:23 +08:00 |
|
 CodexandClaude Opus 4.7
|
254820e6dc
|
拆分 underlying_operations (3021 → 5 子模块 + 2582 行原文件)
把 douyin/core/underlying_operations.py 中 6 个零 self 引用的方法搬到
douyin/core/underlying_operations_pkg/ 子包,类内方法变成 1 行 forwarding。
原文件保留 underlying_operations 巨型类(>50 个实例方法用 self)。
新建子包:
- adb_helpers (34) _adb_path / _pick_adbkeyboard_ime
- pic_path (65) _find_pic_path 按名称查找图片路径
- ocr_content (228) extract_ocr_content OCR 文本拼接 + 置信度
- countdown (179) check_countdown 倒计时文本解析(含 OCR 字符纠错)
- bounds (17) _parse_bounds 解析 UI dump 的 [x1,y1][x2,y2]
策略:6 个方法的 self 引用全为 0,纯算法逻辑直接搬到 module-level;
类内对应方法保留装饰器和签名,body 改为 1 行 forwarding 调用:
@staticmethod
def _adb_path() -> str:
return _impl_adb_path()
外部调用全部不需修改:
- ``self._find_pic_path(...)`` 实例方法 forwarding 仍工作
- ``cls._adb_path()`` staticmethod forwarding 仍工作
- ``ReservationHandler._parse_bounds(...)`` 外部 5 处引用零修改
修复发现:
- countdown.py 原本 ``import datetime``(应为 ``from datetime import datetime,
timedelta``),导致 datetime.now()/timedelta() 触发 NameError 后被外层
except 吞掉返回 False。修正后 check_countdown('5:30') 正确返回 (330, <ts>)
- 子模块内部用 _uo_log,加本地实现避免对原文件的循环依赖
回归:
- 6 个新文件 + 改写后 underlying_operations.py compileall 通过
- pytest 353 passed / 1 skipped
- check_countdown / extract_ocr_content / _parse_bounds /
_pick_adbkeyboard_ime / _find_pic_path / _adb_path 6 个 forwarding 全部正确
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
2026-05-21 19:54:22 +08:00 |
|
 CodexandClaude Opus 4.7
|
246c80498e
|
拆分 douyin_yanghao (922 → 4 子模块 + 788 行原文件保留 yanghao_idle)
把 douyin/other/douyin_yanghao.py 中 6 个独立小函数拆出到
douyin/other/douyin_yanghao_pkg/ 子包,巨型函数 yanghao_idle (756 行)
留在原文件,从子包 import 拿 _yanghao_log/_scaled_click/_do_comment 用。
新建子包:
- logger (40) _yanghao_log + module logger
- click_helpers (75) _scaled_click / _do_comment
- entrypoints (82) yanghao_recommend_flow / yanghao_wait /
yanghao_get_recommend_seconds
(yanghao_recommend_flow 通过 lazy import 调用 yanghao_idle)
外部 import 路径不变:
``from douyin.other.douyin_yanghao import yanghao_recommend_flow / yanghao_wait /
yanghao_get_recommend_seconds`` 等仍可用(原文件 from yanghao_pkg import * re-export)。
- _scaled_click 4 处外部引用 / _yanghao_log 1 处 / 其他 0 处
回归:
- 4 个新文件 + 改写后 douyin_yanghao.py compileall 通过
- pytest 353 passed / 1 skipped
- _yanghao_log() / yanghao_get_recommend_seconds() 调用结果正常
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
2026-05-21 19:08:49 +08:00 |
|
 CodexandClaude Opus 4.7
|
badf64998d
|
拆分 douyin_flow_control (706 → 4 个子模块 + 23 行 shim)
把 douyin/core/douyin_flow_control.py 4 个独立顶层函数拆成
douyin/core/douyin_flow_control_pkg/ 子包:
- stage_handler (34) handle_stage_after_diagnosis 阶段后状态记录
- find_open (537) find_and_open_fudai_detail 找福袋并打开详情(最大头)
- filter (85) filter_fudai_detail 配置筛选决策
- no_fudai (94) handle_no_fudai_situation 无福袋时的简单流程
原文件改为 23 行 re-export shim,4 个公共符号全部保留。
- find_and_open_fudai_detail 4 处外部引用,其他 0 处
全部不需修改。
回归:
- 5 个新文件 + shim compileall 通过
- pytest 353 passed / 1 skipped
- 旧 import 路径与新子包路径返回同一函数对象
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
2026-05-21 19:03:43 +08:00 |
|
 CodexandClaude Opus 4.7
|
c442335b34
|
拆分 douyin_stage_handler (1009 → 5 个子模块 + 26 行 shim)
把 douyin/stage/douyin_stage_handler.py 的 StageHandler 类(4 个
@staticmethod)拆成 douyin/stage/douyin_stage_handler_pkg/ 子包:
- diagnose (37) diagnose_stage_from_current_screen 阶段诊断分发
- check_live (774) check_in_live_room_by_icon 直播间图标检测(最大头)
- handle_detail (20) handle_in_fudai_detail 福袋详情页处理
- handle_room (195) handle_live_room_has_or_not_fudai 直播间福袋检测分发
- handler (32) StageHandler 类(薄壳,每个方法 1 行 forwarding)
策略:4 个方法都是 @staticmethod 第一参数 analyser,搬到 module-level 后
类方法变成 1 行 forwarding。类内部 0 互调,外部 3 处 StageHandler.method
(douyin_fudai.py / fudai_stage_detection.py)保持不变。
外部 import 路径不变:
``from douyin.stage.douyin_stage_handler import StageHandler`` 仍可用。
回归:
- 6 个新文件 + shim compileall 通过
- pytest 353 passed / 1 skipped
- StageHandler.diagnose / module-level diagnose 都正确指向 wrapper / 实现
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
2026-05-21 18:36:41 +08:00 |
|
 CodexandClaude Opus 4.7
|
4ab1b88fa0
|
拆分 douyin_logging_wrapper (1080 → 6 个子模块 + 59 行 shim)
把 douyin/logging/douyin_logging_wrapper.py 的 LoggingWrapper 类(8 个
@staticmethod)按职责拆成 douyin/logging/douyin_logging_wrapper_pkg/ 子包:
- _common (76) 共享:colorama / 占位类 / 模块实例
- enhanced (380) enhanced_log_kv 主入口
- simple (216) _enhanced_log_kv_simple 简化版
- detailed (356) _enhanced_log_kv_detailed 详细版(最大头)
- misc (151) 5 个小型辅助方法(log_step_time / log_error_with_context /
log_performance_step / log_debug_info / get_performance_stats)
- wrapper (55) LoggingWrapper 类(薄壳,每个方法 1 行 forwarding)
策略:8 个方法全是 @staticmethod 第一参数 analyser,搬到 module-level 后
类方法变成 1 行 forwarding。类内部互调(enhanced_log_kv → simple/detailed,
log_error_with_context → enhanced_log_kv)改为直接 import module-level 函数。
外部 import 路径不变:
``from douyin.logging.douyin_logging_wrapper import LoggingWrapper`` 仍可用
(原文件改成 59 行 re-export shim,含 18 个共享符号 / 4 个占位类)。
回归:
- 7 个新文件 + shim compileall 通过
- pytest 353 passed / 1 skipped
- LoggingWrapper.get_performance_stats / module-level 函数 / Fore/Style 占位
全部能正常调用
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
2026-05-21 18:32:03 +08:00 |
|
 CodexandClaude Opus 4.7
|
85bd488f66
|
拆分 douyin_reservation_handler (1314 → 6 个子模块 + 29 行 shim)
把 douyin/reservation/douyin_reservation_handler.py 按职责拆成
douyin/reservation/douyin_reservation_handler_pkg/ 子包:
- find_room (169) find_room_pos_by_title 按标题查找直播间位置
- record_title (333) record_room_title_and_pos 记录直播间标题与位置
- seek_room (319) seek_reservation_room 回退到目标预约直播间
- direct_attend (441) handle_reservation_direct_attend 预约直接参与
- dump_state (180) _dump_room_pos_map_to_state 序列化映射到 state 文件
- handler (43) ReservationHandler 类(薄壳,每个 staticmethod 1 行 forwarding)
策略亮点:原 ReservationHandler 4 个方法都是 @staticmethod 且第一个参数为
analyser,搬出来成 module-level 函数后,类方法变成 1 行 forwarding。
公共 API 100% 保留:ReservationHandler.method(analyser, ...) 完全不需要改。
外部 import 路径不变:
``from douyin.reservation.douyin_reservation_handler import ReservationHandler``
仍可用(原文件改成 29 行 re-export shim)。
- ReservationHandler 5 处外部引用
- find_room_pos_by_title 2 处外部引用
- handle_reservation_direct_attend / _dump_room_pos_map_to_state 各 1 处
全部不需修改。
回归:
- 7 个新文件 + shim compileall 通过
- pytest 353 passed / 1 skipped
- ReservationHandler.find_room_pos_by_title / module-level 函数 / 顶层
_dump_room_pos_map_to_state 都能正常调用
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
2026-05-21 18:21:40 +08:00 |
|
 CodexandClaude Opus 4.7
|
2523668b4c
|
拆分 douyin_fudai_finder (1816 → 6 个子模块 + 29 行 shim)
把 douyin/fudai/douyin_fudai_finder.py 按 5 个类 + 1 顶层函数拆成
douyin/fudai/douyin_fudai_finder_pkg/ 子包:
- image_acquirer (91) FudaiImageAcquirer 截图获取与预处理
- detector (957) FudaiDetector 多算法识别(最大头)
- click_executor (220) FudaiClickExecutor 点击执行
- detail_verifier (237) FudaiDetailVerifier 详情页打开验证
- finder (392) FudaiFinder 4 个组件的组合入口
- optimized_entry (59) check_have_fudai_with_ready_screenshot_optimized 顶层入口
原文件改为 29 行 re-export shim,6 个公共符号全部保留。
- check_have_fudai_with_ready_screenshot_optimized 2 处外部引用
- 其他类全部为 internal class composition,0 处外部引用
回归:
- 7 个新文件 + shim compileall 通过
- pytest 353 passed / 1 skipped
- 旧 import 路径与新子包路径返回同一类对象
- FudaiFinder 实例化后内部组件正确(acquirer / detector / executor / verifier)
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
2026-05-21 17:34:19 +08:00 |
|
 CodexandClaude Opus 4.7
|
e7faceeb5f
|
拆分 fudai_detail_orchestrator (1043 → 2 个子模块 + 17 行 shim)
把 douyin/fudai/core/fudai_detail_orchestrator.py 按 2 个独立顶层函数拆成
douyin/fudai/core/fudai_detail_orchestrator_pkg/ 子包:
- read_once (546) read_fudai_detail_once 单次福袋详情识别
- read_with_retries (513) read_fudai_detail_with_retries 带重试版本
原文件改为 17 行 re-export shim,2 个公共符号全部保留。
- read_fudai_detail_once 5 处外部引用
- read_fudai_detail_with_retries 5 处外部引用
全部不需修改。
子包名 _pkg 后缀避免与同目录 shim 文件 fudai_detail_orchestrator.py 冲突。
回归:
- 3 个新文件 + shim compileall 通过
- pytest 353 passed / 1 skipped
- 旧 import 路径与新子包路径返回同一函数对象
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
2026-05-21 17:23:02 +08:00 |
|
 CodexandClaude Opus 4.7
|
9d1b0c1e36
|
拆分 douyin_logging (1412 → 5 个子模块 + 46 行 shim)
把 douyin/logging/douyin_logging.py 按职责拆成
douyin/logging/douyin_logging_pkg/ 子包:
- _common (21) 共享全局状态:_logging_configured / _logger_cache / _log_monitor
- handlers (206) 自定义 handler:RotatingDatedFileHandler / DatedFileHandler
- cleanup (282) 日志压缩与清理:compress_log_file / cleanup_old_logs / _load_*_policy
- monitor (337) 轮转监控:LogRotationMonitor / start/stop_log_monitor / get_log_stats
- config (652) 主配置入口:get_logger / configure_logging / log_function_call /
LogContext / get_caller_info / format_exception_info
原文件改为 46 行 re-export shim,15 个公共符号全部保留。
全局变量统一搬到 _common,子模块通过 ``from . import _common as _state``
访问 _state.X 形式(global 不能跨模块)。
子包名 douyin_logging_pkg 是为了避免与同目录下的 shim 文件
douyin_logging.py 冲突(同名包 vs 模块在 Python 中不能并存)。
回归:
- 6 个新文件 + shim compileall 通过
- pytest 353 passed / 1 skipped(含 unified_logger MDC 13 个用例)
- 旧 import 路径与新子包路径返回同一函数对象
- get_logger 缓存机制(第二次调用返回同一对象)正常工作
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
2026-05-21 17:13:34 +08:00 |
|
 CodexandClaude Opus 4.7
|
74209035f7
|
拆分 douyin_reservation_logic (2702 → 7 个子模块 + 53 行 shim)
把 douyin/reservation/douyin_reservation_logic.py 按职责拆成
douyin/reservation/reservation_logic/ 子包:
- _common (57) 共享错误处理工具占位 + ReservationItem 类型
- helpers (130) 内部工具:标题归一化 / 相似度 / 排序 / 时间戳
- add (447) add_reservation_core_logic 主入口(添加新预约)
- cleanup_validate (136) validate_back_to_reservation / cleanup_expired_reservations
- queue_full (305) handle_queue_full_wait_at_earliest 队列满时等待策略
- attend_window (1437) process_reservation_attend_window 进入预约窗口(最大头)
- record (328) record_high_value_reservation 高价值预约登记入口
原文件改为 53 行 re-export shim,17 个公共符号全部保留。
- process_reservation_attend_window 7 处外部引用
- handle_queue_full_wait_at_earliest 5 处外部引用
- _now_ts 5 处 / cleanup_expired_reservations 4 处 / _sort_reservations_inplace 4 处
- 其他 5 处以下
全部不需修改。
回归:
- 8 个新文件 + shim compileall 通过
- pytest 353 passed / 1 skipped
- 旧 import 路径与新子包路径返回同一函数对象
- _now_ts / _normalize_room_title / _calculate_string_similarity 等纯函数
调用结果与拆分前一致
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
2026-05-21 17:03:55 +08:00 |
|
 CodexandClaude Opus 4.7
|
787c4e8eec
|
拆分 douyin_detection (1756 → 3 个子模块 + 22 行 shim)
把 douyin/detection/douyin_detection.py 按职责拆成
douyin/detection/detection_pkg/ 子包:
- _common (14) _ensure_detection_cache 共享缓存初始化
- detail (323) check_detail_height + check_in_fudai_detail(详情页相关)
- finder (1438) check_have_fudai_with_ready_screenshot(找福袋图标主入口,最大头)
原文件改为 22 行 re-export shim,4 个公共符号全部保留。
- check_in_fudai_detail 5 处外部引用
- check_have_fudai_with_ready_screenshot 3 处外部引用
- check_detail_height 2 处外部引用
全部不需修改。
子包名 detection_pkg 是为了避免与同目录下的 shim 文件 douyin_detection.py
潜在的命名混淆。
回归:
- 4 个新文件 + shim compileall 通过
- pytest 353 passed / 1 skipped
- 旧 import 路径与新子包路径返回同一函数对象
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
2026-05-21 16:55:24 +08:00 |
|
 CodexandClaude Opus 4.7
|
19e347e6c1
|
拆分 fudai_filter (1090 → 3 个子模块 + 24 行 shim)
把 douyin/fudai/core/fudai_filter.py 按职责拆成
douyin/fudai/core/fudai_filter_pkg/ 子包:
- helpers (126) 小工具:_is_short_countdown_text / check_contain / is_watch_task_fudai
- should_skip (483) should_skip_fudai_by_config 配置筛选总决策
- join_decision (524) basic_join_decision 最终参与决策
原文件改为 24 行 re-export shim,5 个公共符号全部保留。
- check_contain 16 处外部引用
- should_skip_fudai_by_config 14 处外部引用
- is_watch_task_fudai 10 处外部引用
- basic_join_decision 7 处外部引用
- _is_short_countdown_text 5 处外部引用
全部不需修改。
子包名 fudai_filter_pkg 是为了避免与同目录下的 shim 文件 fudai_filter.py
循环 import(同名包 vs 模块在 Python 中不能并存)。
回归:
- 4 个新文件 + shim compileall 通过
- pytest 353 passed / 1 skipped(test_filter_logging 29 用例全过)
- 旧 import 路径与新子包路径返回同一函数对象
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
2026-05-21 16:47:45 +08:00 |
|
 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 |
|
 CodexandClaude Opus 4.7
|
bf7f30996e
|
拆分 douyin_screenshot_manager (1705 → 6 个子模块 + 79 行 shim)
把巨型文件 douyin/handlers/douyin_screenshot_manager.py 按职责拆成
douyin/handlers/screenshot_manager/ 子包:
- _common (79) 共享 logger / 全局状态 / 异步计数器
- paths (205) OCR 目录、调试存档目录、各类路径
- save_files (173) save_latest_attempt / save_last_success / save_*_from_file / cleanup_ocr_dir
- async_save (360) _debug_save_loop + 工作线程启停(global 状态走 _common._state.X)
- cleanup (293) debug_captures 目录清理与轮转
- save_image (731) save_debug_image 主入口(最大头)
原文件改为 79 行 re-export shim,30 个公共符号全部保留。
外部 29 处 save_debug_image / 6 处 save_latest_attempt / 等
import 路径不变,零调用方修改。
回归:
- 子包 7 文件 + shim compileall 通过
- pytest 353 passed / 1 skipped(与拆分前完全一致)
- 旧 import 路径与新子包路径返回同一函数对象
- AST 验证 30 个期望符号全部正确暴露
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
2026-05-21 16:25:59 +08:00 |
|
 CodexandClaude Opus 4.7
|
c5c8def884
|
underlying_operations: 52 处 print → _uo_log
- 新增模块级 _uo_log(msg, level):与项目其他 print→logger 改造一致的模式,
优先走 logging(带 [OCR]/[截图]/[Underlying]/[警告]/[错误] 前缀),失败兜底 stdout
- 替换的内容包括:
- OCR 引擎初始化 / 延迟初始化(PaddleOCR / EasyOCR 切换)
- exec-out 截图 / 文件替换 / 回退方案的失败日志
- 滑动操作失败 / ADB 输入注入异常
- 中奖截图保存 / OCR 调试输出
- paste_text_at / click 等底层操作的调试输出
- 保留为 stdout:
- 设备选择交互(L220-247,含 input() 提示,需要用户在 stdout 看到)
- _uo_log helper 自身的最终兜底(L73)
回归:146 .py 全量编译通过;underlying_operations 类与 _LOGGER 加载正确;
test_filter_logging / check_web_gui_config_sync 通过。
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
2026-05-21 12:54:27 +08:00 |
|
 CodexandClaude Opus 4.7
|
0c62696118
|
P3: 清理过期 TODO + 修正过期路径注释
- operations/__init__.py:
- 模块描述里 "Underlying_Operations.py 模块化" 改为
"douyin/core/underlying_operations.py 模块化拆分"(原文件已迁移)
- 删除 "TODO: 逐步迁移后改为从子模块导入"——
导入是有意保留的向后兼容层,不是待办
- douyin/reservation/core/__init__.py:
- 删除 "临时导入" "TODO: 迁移完成后改为从子模块导入"
- 这个 re-export 层也是有意保留的向后兼容设计
回归:140 .py 编译通过;operations + reservation.core 模块加载 OK;
test_filter_logging / check_web_gui_config_sync 通过。
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
2026-05-21 12:13:31 +08:00 |
|
 CodexandClaude Opus 4.7
|
0d01dabb69
|
P2 §5.3: 23 处 importlib.import_module → 静态 from import
把剩余 5 个文件里所有动态导入 douyin_screenshot_manager 的 importlib 调用
替换为顶部静态 from import 模式:
- douyin/detection/douyin_pixel.py 7 处
- douyin/detection/douyin_detection.py 8 处
- douyin/fudai/douyin_fudai_finder.py 4 处
- douyin/fudai/core/fudai_attend.py 2 处
- gui/gui_app.py 2 处
douyin_screenshot_manager 只引用 douyin.core.path_config,与上述 5 个文件
无循环依赖。bin/run_cli.py 的剩余 1 处 importlib 是有意为之
(绕过 package __init__ 遮蔽),保留。
收益:
- 可读性 + IDE 跳转/类型提示
- 每次调用省去 ~100µs 的 import_module 开销(detection 模块在热路径上调用密集)
- 死代码减少 ~92 行(5 个文件合计 -115 / +23)
回归:140 .py 编译通过;importlib 残留只剩 bin/run_cli 故意 1 处;
5 个模块导入 + fudai_analyse + should_skip_fudai_by_config 业务链路正常;
test_filter_logging / check_web_gui_config_sync 通过。
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
2026-05-21 12:06:23 +08:00 |
|
 CodexandClaude Opus 4.7
|
4f147d214e
|
P2 §5.3: 4 处单点 importlib.import_module → 静态 from import
把单次调用 douyin_screenshot_manager 的 importlib 改为 from-import:
- douyin/core/douyin_flow_control.py
- douyin/core/underlying_operations.py
- douyin/fudai/core/fudai_debug_utils.py
- douyin/stage/douyin_stage.py
douyin_screenshot_manager 只引用 douyin.core.path_config,与上述 4 个文件
无循环依赖,可以安全静态化。bin/run_cli.py 的 importlib 是有意为之
(绕过 package __init__ 遮蔽),保留。
收益:
- 可读性 + IDE 跳转/类型提示
- 每次调用省去 ~100µs 的 import_module 开销
回归:140 .py 编译通过;4 处 importlib 残留全清;
test_filter_logging / check_web_gui_config_sync 通过;
douyin_screenshot_manager 仍可正常加载。
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
2026-05-21 12:01:16 +08:00 |
|
 CodexandClaude Opus 4.7
|
0700a378ec
|
stage + reservation: 孤立 print → logger
- douyin/stage/douyin_stage.py:阶段诊断起始处的 [DEBUG] print 改为
_LOGGER.debug,原本是诊断日志,走 logging 更合适
- douyin/reservation/douyin_reservation.py:当 _RESERVATION_ERROR_UTILS
不可用时的 print 兜底改为 _LOGGER.error,避免日志静默丢失
- 两处都新增模块级 logger
回归:140 .py 编译通过;test_filter_logging / check_web_gui_config_sync 通过。
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
2026-05-21 11:52:28 +08:00 |
|
 CodexandClaude Opus 4.7
|
d5c9936c88
|
gui_app + base_interface: 内部错误 print → logger
gui/gui_app.py(8 处 sys.stderr print → _LOGGER):
- 配置读取失败、日志文件权限/写入错误(warning/error 级)
- pump_logs 内日志插入失败、循环异常、调度下次更新失败(error/warning 级)
- 顶部 import logging + 模块级 _LOGGER
douyin/core/fudai_modules/base_interface.py(2 处 print → _LOGGER):
- BaseFudaiMixin._safe_log 在主类无 _enhanced_log_kv 时的兜底改为 logger.info
- 顶部 import logging + 模块级 _LOGGER
保留为 stdout 的合理场景:
- bin/run_cli.py 的 [TEST]/[YANGHAO-ONLY] CLI 输出
- bin/manage_logs.py 的 CLI 工具输出
- gui/webgui_launcher.py: GUI 同时把 log 输出到控制台
- douyin/logging/internal_loggers.py: logger 模块自身的初始化失败兜底
- douyin/logging/douyin_logging{,_wrapper}.py: 日志系统内部的格式化输出
回归:140 .py 编译通过;test_filter_logging / check_web_gui_config_sync 通过;
gui.gui_app/web_gui/gui_core/base_interface 全部可加载,_LOGGER 名称正确。
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
2026-05-21 11:43:44 +08:00 |
|
Codex
|
0131be7869
|
切换 OCR 默认引擎到 PaddleOCR v4-mobile 并简化预处理
- 默认引擎改为 PaddleOCR PP-OCRv4_mobile(实测 369ms/张,比 EasyOCR 629ms 更快且精度大幅提升,coupon 等关键图错字一片 -> 全对)
- EasyOCR 仅作回退,移除"小图自动放大+锐化+对比度增强"预处理(实测对 Paddle 是负优化,会引入伪影/重复字)
- analyse_pic_word 加 LRU 内容哈希缓存(256 条),重复读图直接命中
- analyse_pic_digits 从 200 行重复实现精简成 30 行委托 + 数字过滤
- 统一两处 OCR 初始化为 _build_paddle / _build_easyocr 工厂,消除重复
- 设置 FLAGS_use_mkldnn=false 绕开 Win + Paddle 3.x 的 oneDNN+PIR 不兼容 bug(实测 FLAGS_enable_pir_in_executor=0 也修不掉,关 oneDNN 是当前唯一可行解)
- 决策依据/速度数据/已知问题归档到 docs/ocr_engine_decision.md
- 业务接口完全向后兼容
|
2026-05-21 10:50:30 +08:00 |
|
 CodexandClaude Opus 4.7
|
7fb0c3849c
|
P0 死代码清理:删 .backup / 空文件 / GUI 占位桩 / 占位目录 / 失效测试
A. 删除 3 个 .backup 文件(约 3.4K 行)
- douyin/detection/douyin_pixel.py.backup
- douyin/stage/douyin_stage_handler.py.backup
- gui/components/log_color_config.py.backup
B. 删除 0 字节文件
- douyin/other/douyin_stuck_guard.py
- docs/功能差异对比.md
- docs/archive/模块化代码对比说明.md
C. 删除 9 个 TODO + pass 占位组件(全仓零外部引用)
- gui/components/{config_manager,image_viewer,stats_display,
reservation_display,high_value_rooms_display,ocr_panel,main_window}.py
- gui/web_components/{proc_runner,http_handler}.py
D. 删除占位目录与失效测试入口
- douyin/detection/core/ 仅 re-export 占位
- douyin/fudai/finder/ 仅 re-export 占位
- tests/run_test.py 指向已删的 deleted_tests_backup/
附加:tools/diagnostics/check_web_gui_config_sync.py --help 字符串里
tools/web_gui_config_manifest.json 旧路径修正为 tools/dev/...
回归:154 → 141 个 .py,全量 compileall 通过;AST 扫描 0 处 import 残留;
gui.gui_app/web_gui/gui_core 仍可加载;fudai_analyse / should_skip_fudai_by_config
业务函数链路正常;test_filter_logging / check_web_gui_config_sync 通过。
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
2026-05-21 10:36:59 +08:00 |
|
 CodexandClaude Opus 4.7
|
71f3653354
|
补回上次合并丢失的关键路径修复 + .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>
|
2026-05-21 10:18:17 +08:00 |
|
zzz
|
2e811e71b3
|
Merge branch 'main' into claude/wonderful-brattain-d1cfe0
|
2026-05-21 09:58:24 +08:00 |
|
 CodexandClaude Opus 4.5
|
73cfb50a2b
|
chore: 删除 fudai_core 中的未使用 import
去除大规模拆分后剩余的死 import:
- PIL.Image (未引用)
- numpy as np (未引用)
- douyin_reservation_logic (未引用)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
2026-05-21 09:49:38 +08:00 |
|
 CodexandClaude Opus 4.7
|
96f8600d42
|
小批量收尾:删除零引用 scrcpy_screenshot + douyin_fudai/log_viewer print→logger
- 删除 operations/scrcpy_screenshot.py(100 行,仅自身定义自身使用,全仓零外部引用)
- douyin/core/douyin_fudai.py:3 处兜底 print → logging.info/warning(_log_kv 失败时的兜底路径)
- gui/components/log_viewer.py:2 处错误 print → _LOGVIEW_LOGGER.exception(日志线程异常 / 刷新显示异常)
回归:149→148 .py,全量编译通过;test_filter_logging / check_web_gui_config_sync 通过;
fudai_analyse 类正常导出,log_viewer 模块加载 OK。
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
2026-05-21 09:40:18 +08:00 |
|
 CodexandClaude Opus 4.7
|
938011f672
|
douyin_screenshot_manager: print → _mgr_log
- 新增模块级 _mgr_log(msg, level):统一走 logging,失败兜底 stdout
- 全部 21 处裸 print 改为 _mgr_log,保留 "[截图管理]" / "[调试图像清理]" 前缀
回归:149 .py 编译通过;test_filter_logging / check_web_gui_config_sync 通过;
get_latest_attempt_path / get_last_success_path / ensure_ocr_dir /
shutdown_debug_save_worker 等公共函数仍可加载。
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
2026-05-21 09:39:19 +08:00 |
|
 CodexandClaude Opus 4.7
|
04035abbc0
|
douyin_robot: print → _robot_log
- 新增模块级 _robot_log(analyser, msg, level):优先 analyser._log_kv("人机校验" 类目),
退化到 logging,最后兜底 stdout
- 全部 10 处裸 print → _robot_log
- "无法处理 + 等待30分钟" 类提示标 level=WARNING
- check_robot_pic_distance 中的 print(x, y) 与 print(x1, first_y) 改为 DEBUG 级,
附带"找到首/末像素"语义说明
回归:149 .py 编译通过;test_filter_logging / check_web_gui_config_sync 通过;
3 个公共函数(check_have_robot_analyse / deal_robot_analyse / check_robot_pic_distance)
仍可正常加载。
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
2026-05-21 09:38:57 +08:00 |
|
 CodexandClaude Opus 4.7
|
49704834d8
|
douyin_yanghao: print → _yanghao_log + 修 3 处 f-string bug
- 新增模块级 _yanghao_log(analyser, msg, level):优先走 analyser._log_kv,
退化到模块 logger,最后兜底 stdout,避免日志静默丢失
- 全部 58 处裸 print 改为 _yanghao_log 调用
- 修 3 处 f-string 缺前缀 bug({prob} 之前是字面量而非插值):
L440 跳过点爱心、L466 跳过点收藏、L498 跳过评论的概率显示
回归:全量 149 .py compileall 通过;douyin_yanghao 4 条 helper 路径
(_log_kv / broken _log_kv / 无 _log_kv 兜底 / 4 个 yanghao_* 顶级函数)
全部 PASS;test_filter_logging / check_web_gui_config_sync 通过。
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
2026-05-21 09:37:46 +08:00 |
|
 CodexandClaude Opus 4.5
|
41c3f28eb7
|
chore: 删除死文件 douyin/fudai/core/fudai_detail_reader.py
该文件只有一个函数 get_fudai_contain(1217 行),但无任何模块
import 它。所有调用方都用的是 douyin_fudai_core.get_fudai_contain。
注:本次 fudai_detail_modules/ 合并时引入的 fudai_detail_orchestrator.py
里的 get_fudai_contain 引用是从 douyin_fudai_core 来的,与本文件无关。
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
2026-05-21 09:36:48 +08:00 |
|
 CodexandClaude Opus 4.5
|
242876f679
|
refactor: 删除 fudai_core 中重复的 attend_choujiang 实现
attend_choujiang 在 fudai_core.py 中的旧版本只是一个回退实现:
开头就先尝试委派到 fudai_attend.attend_choujiang(更新版本),
1597 行的本地实现实际上是死代码——只在 import 失败时才会执行,
而 fudai_attend.py 一直存在。
简化为薄包装函数,直接调用 fudai_attend 中的实现。
文件行数:3799 -> 2208(减 1591 行,约 42%)
本次会话累计 fudai_core 减少:6393 -> 2208(减 4185 行,65%)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
2026-05-21 09:28:52 +08:00 |
|
 CodexandClaude Opus 4.5
|
61ec06092d
|
refactor: 删除 fudai_core 中重复的两个超大函数
douyin_fudai_core.py 中的 should_skip_fudai_by_config (~480 行) 和
basic_join_decision (~1940 行) 与 fudai_filter.py 中的实现高度重复。
保留 fudai_filter.py 中的版本,删除 douyin_fudai_core.py 中的副本。
兼容性:保留薄包装函数,所有现有 import 路径继续工作。
文件行数:6206 -> 3799(减 2407 行,约 39%)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
2026-05-21 09:16:12 +08:00 |
|
 CodexandClaude Opus 4.5
|
7d834d316f
|
refactor: 删除 fudai_core 中重复的 check_contain
check_contain 在 fudai_filter.py 中已有完全相同的实现。
通过顶部 import 直接复用,删除 douyin_fudai_core.py 中的副本。
文件行数:6250 -> 6206(减 44 行)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
2026-05-21 09:11:45 +08:00 |
|
 CodexandClaude Opus 4.5
|
e38640eb63
|
refactor: 删除 fudai_core 中重复的 4 个开奖检查函数
check_lucky_draw_result / check_have_reward_notice_confirm /
check_in_order_confirm_page / get_reward 在 fudai_result_checker.py
中已有更新版本(使用 preprocess_for_ocr 等改进)。
douyin_fudai_core.py 中保留薄包装函数作为兼容 re-export,
确保任何旧调用点继续工作。
文件行数:6347 -> 6250(减 97 行)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
2026-05-21 09:08:43 +08:00 |
|
 CodexandClaude Opus 4.5
|
0031f17ebc
|
refactor: 抽取 is_watch_task_fudai / _is_short_countdown_text 到 fudai_filter
douyin_fudai_core.py 中存在与 fudai_filter.py 完全重复的
is_watch_task_fudai 实现,_is_short_countdown_text 也属于过滤逻辑。
集中到 fudai_filter.py 后,douyin_fudai_core.py 保留薄包装函数
作为兼容 re-export,确保所有既有调用点继续工作。
文件行数:6393 -> 6347(减 46 行)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
2026-05-21 09:04:40 +08:00 |
|
 CodexandClaude Opus 4.5
|
2d6cbecf7e
|
refactor: 抽取 underlying_operations 顶部辅助函数到 io_utils.py
将 4 个模块级辅助函数及相关常量从 underlying_operations.py 抽离到
新建的 douyin/core/io_utils.py:
- _verify_png_integrity
- _safe_replace_file
- _ensure_parent_dir
- _mirror_screenshot_to_external
- _EXTERNAL_DOUYIN_FUDAI_DIR / _EXTERNAL_AXF_SCREENSHOT
underlying_operations.py 仍重新导出这些符号,保持向后兼容,
所有外部 import 无需修改。
文件行数:3508 -> 3342(减 166 行)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
2026-05-21 09:01:14 +08:00 |
|
 CodexandClaude Opus 4.5
|
bdde741db1
|
refactor: 删除冗余的 douyin_logger.py
douyin_logger.py 提供的 get_logger 已被 douyin_logging.get_logger 覆盖。
唯一调用处(wrapper 中的回退路径)改为使用 douyin_logging.get_logger。
douyin/logging/ 模块数:9 -> 8
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
2026-05-21 08:57:34 +08:00 |
|
 CodexandClaude Opus 4.5
|
996990be31
|
refactor: 合并 action_tracker.py 到 action_logger.py
action_tracker.py 只有 28 行,仅定义 track_action 装饰器,
该装饰器内部依赖 ActionLogger 和 PerformanceTracker,
合并到 action_logger.py 更内聚。
douyin/logging/ 模块数:10 -> 9
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
2026-05-21 08:55:40 +08:00 |
|