Update
parent
7107c3a156
commit
dc59e46d7d
|
|
@ -1,6 +1,7 @@
|
|||
# coding=utf-8
|
||||
import os
|
||||
import cv2
|
||||
import re
|
||||
import logging
|
||||
import psycopg2
|
||||
import threading
|
||||
|
|
@ -64,17 +65,20 @@ if __name__ == '__main__':
|
|||
|
||||
with conn:
|
||||
with conn.cursor() as cursor:
|
||||
cursor.execute("SELECT id, status, extends FROM devices WHERE type = 1 AND status in (1, 2) ORDER BY id ASC")
|
||||
cursor.execute("SELECT id, status, extends FROM devices WHERE type = 1 AND status in (1, 2) ORDER BY id DESC")
|
||||
rows = cursor.fetchall()
|
||||
|
||||
threads = []
|
||||
for row in rows:
|
||||
extends = row[2]
|
||||
if isinstance(extends, dict) and extends["rtsp_url"] != '':
|
||||
c = Camera(row[0], extends["rtsp_url"], row[1])
|
||||
t = threading.Thread(target=c.healthbeat)
|
||||
threads.append(t)
|
||||
t.start()
|
||||
|
||||
if not isinstance(extends, dict) or extends["rtsp_url"] is None or not re.search(r'^rtsp:', extends["rtsp_url"]):
|
||||
continue
|
||||
|
||||
c = Camera(row[0], extends["rtsp_url"], row[1])
|
||||
t = threading.Thread(target=c.healthbeat)
|
||||
threads.append(t)
|
||||
t.start()
|
||||
|
||||
for t in threads:
|
||||
t.join()
|
||||
|
|
|
|||
Loading…
Reference in New Issue