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