|
|
|
from core.ViewManager import mVManager
|
|
|
|
from web import create_app
|
|
|
|
from core.ModelManager import mMM
|
|
|
|
import os
|
|
|
|
import platform
|
|
|
|
import shutil
|
|
|
|
import queue
|
|
|
|
import time
|
|
|
|
import asyncio
|
|
|
|
import threading
|
|
|
|
from hypercorn.asyncio import serve
|
|
|
|
from hypercorn.config import Config
|
|
|
|
|
|
|
|
print(f"Current working directory (run.py): {os.getcwd()}")
|
|
|
|
|
|
|
|
def test():
|
|
|
|
test_q = queue.Queue(maxsize=10)
|
|
|
|
test_12 = queue.Queue(maxsize=10)
|
|
|
|
test_q.put("11")
|
|
|
|
test_q.put("22")
|
|
|
|
test_12.put("aa")
|
|
|
|
test_12.put("bb")
|
|
|
|
q_list = []
|
|
|
|
q_list.append(test_q)
|
|
|
|
q_list.append(test_12)
|
|
|
|
while True:
|
|
|
|
for i,q in enumerate(q_list):
|
|
|
|
if q.empty():
|
|
|
|
continue
|
|
|
|
print(q.get())
|
|
|
|
print("执行一次")
|
|
|
|
time.sleep(1)
|
|
|
|
|
|
|
|
web = create_app()
|
|
|
|
|
|
|
|
async def run_quart_app():
|
|
|
|
config = Config()
|
|
|
|
config.bind = ["0.0.0.0:5001"]
|
|
|
|
await serve(web, config)
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
system = platform.system()
|
|
|
|
if system == "Windows":
|
|
|
|
total, used, free = shutil.disk_usage("/")
|
|
|
|
elif system == "Linux":
|
|
|
|
"""获取Linux系统的剩余存储空间"""
|
|
|
|
statvfs = os.statvfs(os.getcwd())
|
|
|
|
free = statvfs.f_bavail * statvfs.f_frsize
|
|
|
|
else:
|
|
|
|
raise NotImplementedError(f"Unsupported operating system: {system}")
|
|
|
|
print(free/(1024*1024))
|
|
|
|
mMM.start_work() # 启动所有通道的处理
|
|
|
|
#mVManager.start_check_rtsp() #线程更新视频在线情况
|
|
|
|
asyncio.run(run_quart_app())
|
|
|
|
|
|
|
|
|