优化后台截图功能
This commit is contained in:
1 parent
223c127e11
commit
ace3bbfa04
70 files changed
+4392
-871
No files matched your search
@@ -0,0 +1,56 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
测试主程序启动截图服务的过程
|
||||
"""
|
||||
|
||||
import sys
|
||||
import os
|
||||
sys.path.insert(0, os.path.dirname(__file__))
|
||||
|
||||
def test_main_startup():
|
||||
print("Testing main startup process...")
|
||||
|
||||
# 模拟主程序中的截图服务启动过程
|
||||
try:
|
||||
print("Step 1: Import ScreenshotService")
|
||||
from operations.screenshot_service import ScreenshotService
|
||||
print("OK: Import successful")
|
||||
|
||||
print("Step 2: Get instance")
|
||||
service = ScreenshotService.get_instance()
|
||||
print("OK: Got instance")
|
||||
|
||||
print("Step 3: Check if device_id exists")
|
||||
analyser_device_id = "MB75DEFQZHZTGMLJ" # 从日志中看到的设备ID
|
||||
print(f"Device ID: {analyser_device_id}")
|
||||
|
||||
if analyser_device_id:
|
||||
print("Step 4: Start service")
|
||||
service.start(analyser_device_id, interval=1.5)
|
||||
print("OK: Service started")
|
||||
|
||||
# 等待一下看看日志
|
||||
import time
|
||||
time.sleep(2)
|
||||
|
||||
print("Step 5: Check service status")
|
||||
info = service.get_cache_info()
|
||||
print(f"Service info: {info}")
|
||||
|
||||
print("Step 6: Stop service")
|
||||
service.stop()
|
||||
print("OK: Service stopped")
|
||||
|
||||
else:
|
||||
print("ERROR: No device_id")
|
||||
|
||||
except Exception as e:
|
||||
import traceback
|
||||
print(f"ERROR during startup: {e}")
|
||||
traceback.print_exc()
|
||||
|
||||
if __name__ == "__main__":
|
||||
test_main_startup()
|
||||
|
||||
|
||||
Reference in new issue
Block a user