为最简化安装环境提供OTA基础信息接口

This commit is contained in:
王华侨
2025-04-26 21:56:41 +08:00
parent 80be8b2eaa
commit e357cad2bb
4 changed files with 114 additions and 4 deletions
+7
View File
@@ -3,6 +3,7 @@ import sys
import signal
from config.settings import load_config, check_config_file
from core.websocket_server import WebSocketServer
from core.ota_server import SimpleOtaServer
from core.utils.util import check_ffmpeg_installed
TAG = __name__
@@ -35,14 +36,20 @@ async def main():
ws_server = WebSocketServer(config)
ws_task = asyncio.create_task(ws_server.start())
# 启动 Simple OAT 服务器
ota_server = SimpleOtaServer(config)
ota_task = asyncio.create_task(ota_server.start())
try:
await wait_for_exit() # 监听退出信号
except asyncio.CancelledError:
print("任务被取消,清理资源中...")
finally:
ws_task.cancel()
ota_task.cancel()
try:
await ws_task
await ota_task
except asyncio.CancelledError:
pass
print("服务器已关闭,程序退出。")