feat: Add AI project summary and coordinate constants for Douyin Fudai

- Created AI_PROJECT_SUMMARY.md for quick understanding of project structure, data flow, key interfaces, and verification points.
- Added key modules and data flow overview for automated participation in Douyin Fudai lottery.
- Introduced a JSON schema example for configuration and provided quick validation steps.
- Updated coordinate constants in coords.py for various cropping areas related to Fudai details, ensuring centralized management of coordinates.
- Generated a new actions log file for tracking actions performed by the application.
This commit is contained in:
Your Name committed 2026-01-03 00:06:59 +08:00
1 parent 0b5f150691
commit 25ed50cc3c
19 files changed
+1829 -654

No files matched your search

+207 -73
View File
@@ -41,15 +41,11 @@ _EXTERNAL_AXF_SCREENSHOT = os.path.join(
os.environ.get(
"EXTERNAL_DOUYIN_FUDAI_DIR",
os.path.join(
os.path.expanduser("~"),
".cursor",
"worktrees",
"douyin_guaji-main",
"axf"
)
os.path.expanduser("~"), ".cursor", "worktrees", "douyin_guaji-main", "axf"
),
),
"pic",
"screenshot.png"
"screenshot.png",
)
@@ -151,7 +147,9 @@ def _mirror_screenshot_to_external(src_file: str) -> None:
# 检查是否是网络路径(UNC路径或网络驱动器)
if external_base.startswith("\\\\") or external_base.startswith("//"):
is_network_path = True
logging.warning("[截图] 检测到网络路径,镜像可能较慢: %s", external_base)
logging.warning(
"[截图] 检测到网络路径,镜像可能较慢: %s", external_base
)
# 检查是否是远程挂载点(简单启发式:包含常见网络挂载标识)
elif ":" in external_base and len(external_base) > 3:
# 可能是网络驱动器,但无法确定,记录路径供诊断
@@ -167,17 +165,32 @@ def _mirror_screenshot_to_external(src_file: str) -> None:
shutil.copyfile(src_file, tmp)
copy_dur = (time_module.time() - copy_start) * 1000.0
if copy_dur > 50.0 or is_network_path:
logging.info("[截图] 镜像复制耗时(ms)=%.1f src=%s dst=%s (网络路径=%s)", copy_dur, src_file, tmp, is_network_path)
logging.info(
"[截图] 镜像复制耗时(ms)=%.1f src=%s dst=%s (网络路径=%s)",
copy_dur,
src_file,
tmp,
is_network_path,
)
replace_start = time_module.time()
_safe_replace_file(tmp, external_path)
replace_dur = (time_module.time() - replace_start) * 1000.0
if replace_dur > 50.0 or is_network_path:
logging.info("[截图] 镜像文件替换耗时(ms)=%.1f (网络路径=%s)", replace_dur, is_network_path)
logging.info(
"[截图] 镜像文件替换耗时(ms)=%.1f (网络路径=%s)",
replace_dur,
is_network_path,
)
mirror_total_dur = (time_module.time() - mirror_start) * 1000.0
if mirror_total_dur > 100.0 or is_network_path:
logging.info("[截图] 镜像总耗时(ms)=%.1f path=%s (网络路径=%s)", mirror_total_dur, external_path, is_network_path)
logging.info(
"[截图] 镜像总耗时(ms)=%.1f path=%s (网络路径=%s)",
mirror_total_dur,
external_path,
is_network_path,
)
except Exception:
# 任何错误都不应该影响截图主流程
pass
@@ -206,6 +219,7 @@ class underlying_operations:
# 改为直接静默导入和初始化
# 尝试按需导入 easyocr,避免静态检查器在缺少依赖时报错
import importlib
try:
easyocr = importlib.import_module("easyocr")
except Exception:
@@ -244,7 +258,7 @@ class underlying_operations:
except Exception:
pass
try:
devnull = open(os.devnull, "w")
devnull = open(os.devnull, "w", encoding="utf-8")
with contextlib.redirect_stdout(
devnull
), contextlib.redirect_stderr(devnull):
@@ -262,9 +276,9 @@ class underlying_operations:
use_textline_orientation=False,
)
self.ocr_type = "paddleocr"
print(f"[OCR] EasyOCR不可用,使用 PaddleOCR(CPU模式)")
print("[OCR] EasyOCR不可用,使用 PaddleOCR(CPU模式)")
print(
f"[OCR] 提示:安装EasyOCR可提升速度,运行: pip install easyocr"
"[OCR] 提示:安装EasyOCR可提升速度,运行: pip install easyocr"
)
except Exception:
# 若静默初始化失败,保留 None 并允许后续按需初始化,避免阻塞启动。
@@ -304,7 +318,6 @@ class underlying_operations:
adb = adb[1:-1]
return adb
def _ensure_ocr(self):
if self.ocr is not None:
return
@@ -315,6 +328,7 @@ class underlying_operations:
try:
# 在Windows上,避免使用stderr重定向,可能会导致"lost sys.stderr"问题
import importlib
try:
easyocr = importlib.import_module("easyocr")
except Exception:
@@ -334,7 +348,7 @@ class underlying_operations:
)
self.ocr_type = "easyocr"
gpu_status = "GPU加速" if False else "CPU模式"
gpu_status = "CPU模式"
print(f"[OCR] 延迟初始化:使用 EasyOCR({gpu_status})")
else:
raise ImportError("easyocr not available")
@@ -343,7 +357,7 @@ class underlying_operations:
print(f"[OCR] 延迟初始化EasyOCR失败: {e},回退到PaddleOCR")
devnull = None
try:
devnull = open(os.devnull, "w")
devnull = open(os.devnull, "w", encoding="utf-8")
with contextlib.redirect_stdout(devnull), contextlib.redirect_stderr(
devnull
):
@@ -361,7 +375,7 @@ class underlying_operations:
use_textline_orientation=False,
)
self.ocr_type = "paddleocr"
print(f"[OCR] 延迟初始化:使用 PaddleOCR(CPU模式)")
print("[OCR] 延迟初始化:使用 PaddleOCR(CPU模式)")
except Exception:
self.ocr = None
self.ocr_type = None
@@ -425,9 +439,11 @@ class underlying_operations:
"""
try:
import path_config
pic_base = path_config.get_pic_dir()
except Exception:
import path_config
pic_base = path_config.get_pic_dir()
# 运行时必需文件始终在根目录(不需要移动)
@@ -439,7 +455,10 @@ class underlying_operations:
# OCR图片文件:按分类组织到子目录
try:
import importlib
douyin_screenshot_manager = importlib.import_module("douyin.handlers.douyin_screenshot_manager")
douyin_screenshot_manager = importlib.import_module(
"douyin.handlers.douyin_screenshot_manager"
)
category = douyin_screenshot_manager.get_category_for_picname(picname)
except Exception:
category = "others"
@@ -481,47 +500,69 @@ class underlying_operations:
if use_service:
try:
from operations.screenshot_service import ScreenshotService
service = ScreenshotService.get_instance()
# 诊断:检查服务是否在运行
service_running = getattr(service, "_running", False)
if not service_running:
logging.debug("[截图] 后台服务未运行,尝试启动 device=%s", device_id)
logging.debug(
"[截图] 后台服务未运行,尝试启动 device=%s", device_id
)
try:
service.start(device_id, interval=1.5)
# 等待一小段时间让服务完成第一次截图
time_module.sleep(0.2)
except Exception as start_err:
logging.warning("[截图] 启动后台服务失败: %s,将使用直接截图", start_err)
logging.warning(
"[截图] 启动后台服务失败: %s,将使用直接截图", start_err
)
try:
service_result = service.get_screenshot(device_id, force=False)
if service_result:
dur = (time.time() - start_ts) * 1000.0
logging.info("[截图] 使用后台服务耗时(ms)=%.1f device=%s", dur, device_id)
logging.info(
"[截图] 使用后台服务耗时(ms)=%.1f device=%s", dur, device_id
)
return True
else:
from datetime import datetime
timetag = datetime.now().strftime("%H:%M:%S")
logging.info("[%s] [截图操作] 后台服务未提供有效截图,回退到直接截图", timetag)
logging.info(
"[%s] [截图操作] 后台服务未提供有效截图,回退到直接截图",
timetag,
)
# 不 return,这里继续走直接截图逻辑
except Exception as e:
from datetime import datetime
timetag = datetime.now().strftime("%H:%M:%S")
logging.warning("[%s] [截图操作] 调用后台服务异常,回退到直接截图: %s", timetag, e)
logging.warning(
"[%s] [截图操作] 调用后台服务异常,回退到直接截图: %s",
timetag,
e,
)
except ImportError as e:
from datetime import datetime
timetag = datetime.now().strftime("%H:%M:%S")
logging.warning("[%s] [截图操作] 无法导入截图服务模块,回退到直接截图: %s", timetag, e)
logging.warning(
"[%s] [截图操作] 无法导入截图服务模块,回退到直接截图: %s",
timetag,
e,
)
except Exception as e:
from datetime import datetime
timetag = datetime.now().strftime("%H:%M:%S")
logging.warning("[%s] [截图操作] 服务模式不可用,回退到直接截图: %s", timetag, e)
logging.warning(
"[%s] [截图操作] 服务模式不可用,回退到直接截图: %s", timetag, e
)
# 原有的直接截图逻辑(保持向后兼容),测量其耗时
result = self._get_screenshot_direct(device_id, path)
dur = (time.time() - start_ts) * 1000.0
logging.info("[截图] 总耗时(ms)=%.1f device=%s use_service=%s result=%s", dur, device_id, bool(use_service), result)
logging.info(
"[截图] 总耗时(ms)=%.1f device=%s use_service=%s result=%s",
dur,
device_id,
bool(use_service),
result,
)
return result
def _get_screenshot_direct(self, device_id, path="pic"):
@@ -531,9 +572,11 @@ class underlying_operations:
if path == "pic":
try:
import path_config
out_dir = path_config.get_pic_dir()
except Exception:
import path_config
out_dir = path_config.get_pic_dir()
else:
out_dir = os.path.join(os.path.dirname(__file__), "target_pic")
@@ -586,7 +629,11 @@ class underlying_operations:
return False
header_check_dur = (time_module.time() - header_check_start) * 1000.0
if header_check_dur > 10.0: # 只记录超过10ms的
logging.debug("[截图] PNG头尾校验耗时(ms)=%.1f path=%s", header_check_dur, path0)
logging.debug(
"[截图] PNG头尾校验耗时(ms)=%.1f path=%s",
header_check_dur,
path0,
)
# 优化:只在必要时使用 PIL 验证(PIL verify 可能很慢)
# 对于临时文件,快速验证已足够;对于最终文件,可以跳过完整验证以提高速度
@@ -606,7 +653,11 @@ class underlying_operations:
verify_total_dur = (time_module.time() - verify_start) * 1000.0
if verify_total_dur > 100.0: # 只记录超过100ms的
logging.info("[截图] _valid_png总耗时(ms)=%.1f path=%s", verify_total_dur, path0)
logging.info(
"[截图] _valid_png总耗时(ms)=%.1f path=%s",
verify_total_dur,
path0,
)
return True
except Exception:
return False
@@ -649,10 +700,18 @@ class underlying_operations:
# 等待进程完成
return_code = process.wait(timeout=10)
if return_code != 0:
raise subprocess.CalledProcessError(return_code, [adb, "-s", device_id, "exec-out", "screencap", "-p"])
raise subprocess.CalledProcessError(
return_code,
[adb, "-s", device_id, "exec-out", "screencap", "-p"],
)
adb_subprocess_dur = (time_module.time() - adb_start) * 1000.0
logging.info("[截图] ADB exec-out subprocess耗时(ms)=%.1f device=%s attempt=%d", adb_subprocess_dur, device_id, attempt + 1)
logging.info(
"[截图] ADB exec-out subprocess耗时(ms)=%.1f device=%s attempt=%d",
adb_subprocess_dur,
device_id,
attempt + 1,
)
# 优化:移除 fsync(现代文件系统会自动同步,减少不必要的磁盘I/O)
# 文件写入已经完成,操作系统会在适当时机同步到磁盘
@@ -665,7 +724,11 @@ class underlying_operations:
is_valid = _valid_png(tmp_file)
validate_tmp_dur = (time_module.time() - validate_tmp_start) * 1000.0
if validate_tmp_dur > 50.0:
logging.info("[截图] 临时文件验证耗时(ms)=%.1f result=%s", validate_tmp_dur, is_valid)
logging.info(
"[截图] 临时文件验证耗时(ms)=%.1f result=%s",
validate_tmp_dur,
is_valid,
)
if is_valid:
# 使用安全的文件替换函数
@@ -673,14 +736,20 @@ class underlying_operations:
replace_success = _safe_replace_file(tmp_file, out_file)
replace_dur = (time_module.time() - replace_start) * 1000.0
if replace_dur > 50.0:
logging.info("[截图] 文件替换耗时(ms)=%.1f result=%s", replace_dur, replace_success)
logging.info(
"[截图] 文件替换耗时(ms)=%.1f result=%s",
replace_dur,
replace_success,
)
if replace_success:
mirror_start = time_module.time()
_mirror_screenshot_to_external(out_file)
mirror_dur = (time_module.time() - mirror_start) * 1000.0
if mirror_dur > 50.0:
logging.info("[截图] 镜像到外部路径耗时(ms)=%.1f", mirror_dur)
logging.info(
"[截图] 镜像到外部路径耗时(ms)=%.1f", mirror_dur
)
# 优化:快速验证目标文件(只检查存在和大小,不进行完整PNG验证)
# 完整验证可以在读取时进行,不阻塞截图流程
@@ -695,13 +764,27 @@ class underlying_operations:
with open(out_file, "rb") as f:
header = f.read(4)
if header == b"\x89PNG":
validate_out_dur = (time_module.time() - validate_out_start) * 1000.0
validate_out_dur = (
time_module.time()
- validate_out_start
) * 1000.0
if validate_out_dur > 50.0:
logging.info("[截图] 目标文件快速验证耗时(ms)=%.1f", validate_out_dur)
logging.info(
"[截图] 目标文件快速验证耗时(ms)=%.1f",
validate_out_dur,
)
overall_dur = (time_module.time() - overall_start) * 1000.0
logging.info("[截图] _get_screenshot_direct总耗时(ms)=%.1f device=%s (exec-out成功)", overall_dur, device_id)
print(f"[{timetag}] [截图] ✓ 获取屏幕截图成功")
overall_dur = (
time_module.time() - overall_start
) * 1000.0
logging.info(
"[截图] _get_screenshot_direct总耗时(ms)=%.1f device=%s (exec-out成功)",
overall_dur,
device_id,
)
print(
f"[{timetag}] [截图] ✓ 获取屏幕截图成功"
)
return True
except Exception:
pass
@@ -709,7 +792,9 @@ class underlying_operations:
# 如果快速验证失败,记录诊断信息
try:
st = os.stat(out_file)
print(f"[截图诊断] 目标文件验证失败: size={st.st_size}, mtime={st.st_mtime}")
print(
f"[截图诊断] 目标文件验证失败: size={st.st_size}, mtime={st.st_mtime}"
)
except Exception:
pass
except Exception:
@@ -719,7 +804,9 @@ class underlying_operations:
try:
if os.path.exists(tmp_file):
st = os.stat(tmp_file)
print(f"[截图诊断] 临时文件存在但替换失败: tmp={tmp_file}, size={st.st_size}")
print(
f"[截图诊断] 临时文件存在但替换失败: tmp={tmp_file}, size={st.st_size}"
)
except Exception:
pass
# 继续尝试回退方案
@@ -728,13 +815,15 @@ class underlying_operations:
try:
if os.path.exists(tmp_file):
st = os.stat(tmp_file)
print(f"[截图诊断] 临时文件无效: path={tmp_file}, size={st.st_size}")
print(
f"[截图诊断] 临时文件无效: path={tmp_file}, size={st.st_size}"
)
except Exception:
pass
# 继续尝试回退方案
except subprocess.TimeoutExpired:
# 超时异常,记录并继续重试
print(f"[截图] exec-out 超时,尝试重试或回退方案")
print("[截图] exec-out 超时,尝试重试或回退方案")
try:
if os.path.exists(tmp_file):
os.remove(tmp_file)
@@ -769,7 +858,11 @@ class underlying_operations:
timeout=10, # 添加超时
)
shell_screencap_dur = (time_module.time() - shell_screencap_start) * 1000.0
logging.info("[截图] 回退方案-shell screencap耗时(ms)=%.1f device=%s", shell_screencap_dur, device_id)
logging.info(
"[截图] 回退方案-shell screencap耗时(ms)=%.1f device=%s",
shell_screencap_dur,
device_id,
)
pull_start = time_module.time()
subprocess.run(
@@ -780,32 +873,55 @@ class underlying_operations:
timeout=10, # 添加超时
)
pull_dur = (time_module.time() - pull_start) * 1000.0
logging.info("[截图] 回退方案-adb pull耗时(ms)=%.1f device=%s", pull_dur, device_id)
logging.info(
"[截图] 回退方案-adb pull耗时(ms)=%.1f device=%s", pull_dur, device_id
)
fallback_validate_start = time_module.time()
if _valid_png(tmp_file):
fallback_validate_dur = (time_module.time() - fallback_validate_start) * 1000.0
fallback_validate_dur = (
time_module.time() - fallback_validate_start
) * 1000.0
if fallback_validate_dur > 50.0:
logging.info("[截图] 回退方案-临时文件验证耗时(ms)=%.1f", fallback_validate_dur)
logging.info(
"[截图] 回退方案-临时文件验证耗时(ms)=%.1f",
fallback_validate_dur,
)
# 使用安全的文件替换函数
fallback_replace_start = time_module.time()
if _safe_replace_file(tmp_file, out_file):
fallback_replace_dur = (time_module.time() - fallback_replace_start) * 1000.0
fallback_replace_dur = (
time_module.time() - fallback_replace_start
) * 1000.0
if fallback_replace_dur > 50.0:
logging.info("[截图] 回退方案-文件替换耗时(ms)=%.1f", fallback_replace_dur)
logging.info(
"[截图] 回退方案-文件替换耗时(ms)=%.1f",
fallback_replace_dur,
)
fallback_mirror_start = time_module.time()
_mirror_screenshot_to_external(out_file)
fallback_mirror_dur = (time_module.time() - fallback_mirror_start) * 1000.0
fallback_mirror_dur = (
time_module.time() - fallback_mirror_start
) * 1000.0
if fallback_mirror_dur > 50.0:
logging.info("[截图] 回退方案-镜像耗时(ms)=%.1f", fallback_mirror_dur)
logging.info(
"[截图] 回退方案-镜像耗时(ms)=%.1f", fallback_mirror_dur
)
try:
if _valid_png(out_file):
overall_dur = (time_module.time() - overall_start) * 1000.0
fallback_total_dur = (time_module.time() - fallback_start) * 1000.0
logging.info("[截图] _get_screenshot_direct总耗时(ms)=%.1f device=%s (回退方案成功, 回退部分耗时=%.1fms)", overall_dur, device_id, fallback_total_dur)
fallback_total_dur = (
time_module.time() - fallback_start
) * 1000.0
logging.info(
"[截图] _get_screenshot_direct总耗时(ms)=%.1f device=%s (回退方案成功, 回退部分耗时=%.1fms)",
overall_dur,
device_id,
fallback_total_dur,
)
print("{} 获取屏幕截图".format(timetag))
return True
except Exception:
@@ -819,12 +935,16 @@ class underlying_operations:
if os.path.exists(tmp_file):
# 尝试直接覆盖写入(如果文件被占用,这会失败,但至少尝试了)
try:
with open(tmp_file, "rb") as src, open(out_file, "wb") as dst:
with open(tmp_file, "rb") as src, open(
out_file, "wb"
) as dst:
dst.write(src.read())
_mirror_screenshot_to_external(out_file)
try:
if _valid_png(out_file):
print(f"[{timetag}] [截图] ✓ 获取屏幕截图成功(通过直接写入)")
print(
f"[{timetag}] [截图] ✓ 获取屏幕截图成功(通过直接写入)"
)
return True
except Exception:
pass
@@ -835,13 +955,17 @@ class underlying_operations:
_mirror_screenshot_to_external(out_file)
try:
if _valid_png(out_file):
print(f"[{timetag}] [截图] ✓ 获取屏幕截图成功(通过优化替换)")
print(
f"[{timetag}] [截图] ✓ 获取屏幕截图成功(通过优化替换)"
)
return True
except Exception:
pass
else:
# 最后兜底:返回True,让调用者知道临时文件存在
print(f"[截图] 文件替换失败({e}),但截图已保存到临时文件 {tmp_file}")
print(
f"[截图] 文件替换失败({e}),但截图已保存到临时文件 {tmp_file}"
)
return True
except Exception:
print(f"[截图] 文件替换失败,但截图已保存到临时文件 {tmp_file}")
@@ -922,9 +1046,11 @@ class underlying_operations:
def save_reward_pic(self, device_id):
try:
import path_config
out_dir = path_config.get_pic_dir()
except Exception:
import path_config
out_dir = path_config.get_pic_dir()
if not os.path.exists(out_dir):
os.makedirs(out_dir)
@@ -1071,11 +1197,15 @@ class underlying_operations:
# 默认不保存,避免每次cut_pic都进行文件I/O操作(可节省50-200ms)
try:
# 检查是否启用调试图像保存
save_debug = os.environ.get("SAVE_CUT_PIC_DEBUG_IMAGES", "0") == "1"
save_debug = (
os.environ.get("SAVE_CUT_PIC_DEBUG_IMAGES", "0") == "1"
)
if not save_debug:
# 检查全局配置
try:
save_debug = os.environ.get("SAVE_DEBUG_IMAGES", "0") == "1"
save_debug = (
os.environ.get("SAVE_DEBUG_IMAGES", "0") == "1"
)
except Exception:
pass
@@ -1101,7 +1231,9 @@ class underlying_operations:
)
if debug_path:
try:
logging.info(f"[调试图像] cut_pic保存: {debug_path}")
logging.info(
"[调试图像] cut_pic保存: %s", debug_path
)
except Exception:
pass
except Exception:
@@ -1200,7 +1332,7 @@ class underlying_operations:
)
if debug_path:
try:
logging.info(f"[调试图像] cut_pic保存: {debug_path}")
logging.info("[调试图像] cut_pic保存: %s", debug_path)
except Exception:
pass
except Exception:
@@ -1342,7 +1474,7 @@ class underlying_operations:
)
if debug_path:
try:
logging.info(f"[调试图像] OCR预处理保存: {debug_path}")
logging.info("[调试图像] OCR预处理保存: %s", debug_path)
except Exception:
pass
except Exception:
@@ -1474,6 +1606,7 @@ class underlying_operations:
full_screenshot = None
try:
import path_config
screenshot_path = path_config.get_screenshot_path()
if os.path.exists(screenshot_path):
full_screenshot = Image.open(screenshot_path)
@@ -1483,7 +1616,9 @@ class underlying_operations:
pass
# 如果成功加载完整截图,使用完整截图;否则使用预处理图像
debug_image = full_screenshot if full_screenshot is not None else img_for_attempt
debug_image = (
full_screenshot if full_screenshot is not None else img_for_attempt
)
extra_info_dict["has_full_screenshot"] = full_screenshot is not None
extra_info_dict["has_coords"] = ocr_coords is not None
@@ -1679,7 +1814,7 @@ class underlying_operations:
)
if debug_path:
try:
logging.info(f"[调试图像] OCR数字预处理保存: {debug_path}")
logging.info("[调试图像] OCR数字预处理保存: %s", debug_path)
except Exception:
pass
except Exception:
@@ -1803,7 +1938,6 @@ class underlying_operations:
# 对于倒计时:通常是1-2位数字
# 尝试提取最后几个数字(通常是实际值)
# 或者提取最短的连续数字段
import re
# 提取所有连续的数字段
digit_segments = re.findall(r"\d+", str(text))
@@ -2237,7 +2371,6 @@ class underlying_operations:
执行命令:adb shell input swipe <start_x> <start_y> <end_x> <end_y> <duration_ms>
"""
import subprocess
adb_cmd = self._adb()
# 注意:adb input swipe 的参数顺序是:start_x start_y end_x end_y duration_ms
@@ -2294,9 +2427,6 @@ class underlying_operations:
def _swipe_with_sendevent(self, device_id, x1, y1, x2, y2, steps):
"""使用 sendevent 方法滑动(需要 root 权限)"""
import subprocess
import time
# 获取触摸设备路径
result = subprocess.run(
f"{self._adb()} -s {device_id} shell getevent -p | grep -A 5 ABS_MT",
@@ -2812,9 +2942,11 @@ class underlying_operations:
try:
import path_config
local_path = path_config.get_window_dump_path()
except Exception:
import path_config
local_path = path_config.get_window_dump_path()
start = time.time()
while True:
@@ -2863,9 +2995,11 @@ class underlying_operations:
"""
try:
import path_config
local_path = path_config.get_window_dump_path()
except Exception:
import path_config
local_path = path_config.get_window_dump_path()
start = time.time()