- Removed trailing whitespace and ensured files end with a single newline in cleanup_unused_files.py. - Added fix_trailing_whitespace.py to batch remove trailing whitespace from Python files. - Updated install_dependencies.py to improve dependency installation prompts. - Cleaned up pick_coords.py by removing unnecessary whitespace and improving code readability. - Enhanced region_selector.py by disabling specific pylint checks for better compatibility with third-party libraries. - Improved WPS流程图生成工具.py by cleaning up whitespace and enhancing readability. - Updated __init__.py in typings to remove unnecessary lines. - Modified app.js to adjust default configuration values and clean up unused code.
60 lines
1.6 KiB
Python
60 lines
1.6 KiB
Python
#!/usr/bin/env python3
|
|
# -*- coding: utf-8 -*-
|
|
"""
|
|
测试截图服务修复效果
|
|
"""
|
|
|
|
import time
|
|
import sys
|
|
import os
|
|
|
|
# 添加项目根目录到路径
|
|
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
|
|
|
def test_service_startup():
|
|
"""测试截图服务启动"""
|
|
print("测试截图服务启动修复...")
|
|
|
|
# 模拟启动过程
|
|
from douyin.core.douyin_fudai import fudai_analyse
|
|
|
|
# 创建分析器实例
|
|
analyser_instance = fudai_analyse()
|
|
|
|
print("启动fudai_choujiang(只运行几秒钟测试服务启动)...")
|
|
|
|
try:
|
|
# 设置设备ID(需要根据实际情况修改)
|
|
device_id = "emulator-5554" # 或者其他设备ID
|
|
|
|
# 启动服务(只运行5秒)
|
|
analyser_instance.fudai_choujiang(
|
|
device_id=device_id,
|
|
wait_minutes=0, # 不等待,直接测试启动
|
|
)
|
|
|
|
except KeyboardInterrupt:
|
|
print("测试被中断")
|
|
except Exception as e:
|
|
print(f"测试过程中出现异常: {e}")
|
|
import traceback
|
|
traceback.print_exc()
|
|
|
|
# 检查服务状态
|
|
print("\n检查服务状态:")
|
|
from operations.screenshot_service import ScreenshotService
|
|
service = ScreenshotService.get_instance()
|
|
info = service.get_cache_info()
|
|
|
|
print(f"服务运行中: {info['running']}")
|
|
print(f"设备ID: {info['device_id']}")
|
|
print(f"后台线程: {'运行中' if hasattr(service, '_thread') and service._thread and service._thread.is_alive() else '未运行'}")
|
|
|
|
# 停止服务
|
|
if service.is_running():
|
|
service.stop()
|
|
print("服务已停止")
|
|
|
|
if __name__ == "__main__":
|
|
test_service_startup()
|