from __future__ import annotations """screenshot_manager - 截图管理子包(双截图记录 + 异步调试保存)。 原 douyin/handlers/douyin_screenshot_manager.py 拆成 6 个子模块: - _common 共享 logger / 全局状态 / 异步计数器 - paths OCR 目录、调试存档目录、各类路径计算 - save_files save_latest_attempt / save_last_success / save_*_from_file / cleanup_ocr_dir - async_save _debug_save_loop + 工作线程启停 - cleanup debug_captures 目录的清理与轮转 - save_image save_debug_image 主入口 外部 import 路径不变:from douyin.handlers.douyin_screenshot_manager import save_debug_image 仍能工作(原文件改为 re-export shell)。 """ from ._common import ( _LOGGER, _mgr_log, _debug_save_queue, _debug_save_worker_lock, _debug_save_shutdown_event, _async_save_counters_lock, _SKIP_DEBUG_SAVE_IN_HOTLOOPS, get_async_save_counters, reset_async_save_counters, ) from .paths import ( get_ocr_dir, get_category_for_picname, get_latest_attempt_path, get_last_success_path, ensure_ocr_dir, get_debug_captures_dir, ensure_debug_captures_dir, get_debug_captures_base_dir, ) from .save_files import ( cleanup_ocr_dir, save_latest_attempt, save_last_success, save_attempt_from_file, save_success_from_file, ) from .async_save import ( _debug_save_loop, _ensure_debug_save_worker_started, shutdown_debug_save_worker, ) from .cleanup import ( count_debug_captures_files, cleanup_debug_captures, init_debug_captures_cleanup, ) from .save_image import ( _sanitize_filename_part, save_debug_image, ) __all__ = [ "_LOGGER", "_mgr_log", "get_async_save_counters", "reset_async_save_counters", "get_ocr_dir", "get_category_for_picname", "get_latest_attempt_path", "get_last_success_path", "ensure_ocr_dir", "get_debug_captures_dir", "ensure_debug_captures_dir", "get_debug_captures_base_dir", "cleanup_ocr_dir", "save_latest_attempt", "save_last_success", "save_attempt_from_file", "save_success_from_file", "shutdown_debug_save_worker", "count_debug_captures_files", "cleanup_debug_captures", "init_debug_captures_cleanup", "save_debug_image", ]