refactor: Remove outdated files and enhance Web GUI functionality
- Deleted obsolete markdown files related to follow tab coordinates testing and results. - Removed outdated batch scripts for launching the Web GUI. - Updated `config.json` to improve reservation handling and adjust prize value settings. - Enhanced logging and error handling in `web_gui.py` and `app.js` for better user experience. - Added automatic screenshot functionality during Web GUI startup for improved monitoring.
This commit is contained in:
1 parent
b0bd7c72c8
commit
836a31d817
59 files changed
+17232
-6965
No files matched your search
+45
-1
@@ -1,8 +1,50 @@
|
||||
import argparse
|
||||
import importlib.util
|
||||
import os
|
||||
import shutil
|
||||
import sys
|
||||
|
||||
# ==== 兼容导入完整逻辑模块 douyin_fudai 及其依赖 ==============================
|
||||
# 当前 WebGUI 目录中没有完整版 douyin_fudai.py,而是在 Cursor 的工作树中存在完整实现。
|
||||
# 同时,我们在本目录下放置了一些 shim 模块(如 douyin_text_utils、douyin_swipe_ops 等),
|
||||
# 需要优先加载这些本地实现,再去加载完整逻辑模块。
|
||||
|
||||
_BASE_DIR = os.path.dirname(__file__)
|
||||
_EXTERNAL_DOUYIN_FUDAI_DIR = r"C:\Users\12742\.cursor\worktrees\douyin_guaji-main\axf"
|
||||
|
||||
|
||||
def _load_local_shim(mod_name: str, rel_path: str) -> None:
|
||||
"""从当前工程目录加载本地 shim 模块,并注册到 sys.modules。"""
|
||||
if mod_name in sys.modules:
|
||||
return
|
||||
path = os.path.join(_BASE_DIR, rel_path)
|
||||
if not os.path.isfile(path):
|
||||
return
|
||||
try:
|
||||
spec = importlib.util.spec_from_file_location(mod_name, path)
|
||||
if spec is None or spec.loader is None:
|
||||
return
|
||||
module = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(module)
|
||||
sys.modules[mod_name] = module
|
||||
except Exception:
|
||||
# shim 加载失败不影响主流程,后续仍可尝试外部模块
|
||||
return
|
||||
|
||||
|
||||
# 1) 先加载本地 shim 模块,确保后续 import 优先使用这些实现
|
||||
_load_local_shim("douyin_text_utils", "douyin_text_utils.py")
|
||||
_load_local_shim("douyin_swipe_ops", "douyin_swipe_ops.py")
|
||||
_load_local_shim("douyin_reservation_ops", "douyin_reservation_ops.py")
|
||||
|
||||
# 2) 再把完整逻辑所在目录追加到 sys.path,供 `douyin_fudai` 等模块导入
|
||||
try:
|
||||
if os.path.isdir(_EXTERNAL_DOUYIN_FUDAI_DIR) and _EXTERNAL_DOUYIN_FUDAI_DIR not in sys.path:
|
||||
sys.path.append(_EXTERNAL_DOUYIN_FUDAI_DIR)
|
||||
except Exception:
|
||||
# 不影响主流程;如果目录不存在,后续导入会按默认逻辑报错
|
||||
pass
|
||||
|
||||
# 在导入 PaddleOCR 之前设置,避免每次启动都做连通性检查提示并抑制底层 glog/oneDNN 等噪音
|
||||
# DISABLE_MODEL_SOURCE_CHECK: 跳过 PaddleOCR 的主机连通性检查(国内网络环境常卡)
|
||||
# GLOG_minloglevel: 2 -> ERROR 及以上,屏蔽 INFO/WARNING
|
||||
@@ -158,6 +200,8 @@ def main(argv: list[str]) -> int:
|
||||
analyser.y_pianyi = int(args.y_pianyi or 0)
|
||||
analyser.resolution_ratio_x, analyser.resolution_ratio_y = analyser.operation.get_device_resolution(device_id)
|
||||
analyser.yanghao_use_recommend_flow = True
|
||||
# 加载配置(包括养号相关配置)
|
||||
analyser.load_config()
|
||||
print("[TEST] device_id={} res={}x{}".format(device_id, analyser.resolution_ratio_x, analyser.resolution_ratio_y))
|
||||
seconds = int(getattr(args, "test_yanghao_flow_seconds", 10) or 10)
|
||||
if seconds < 1:
|
||||
@@ -239,4 +283,4 @@ if __name__ == "__main__":
|
||||
print_version_banner("run_cli")
|
||||
except Exception:
|
||||
pass
|
||||
raise SystemExit(main(sys.argv[1:]))
|
||||
raise SystemExit(main(sys.argv[1:]))
|
||||
Reference in new issue
Block a user