-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.py
More file actions
38 lines (23 loc) · 949 Bytes
/
main.py
File metadata and controls
38 lines (23 loc) · 949 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
from flask_api import flask_api
from camera import Camera
from web_connector_api import web_connector
from db_helper import DbHelper
if __name__ == '__main__':
# creating the db helper object to get the functions of the database.
db_helper = DbHelper()
# starting the cameras.
frame_buffer = {}
camera_buffer = []
# starting the cameras.
camera_details = db_helper.get_camera_details()
for one_camera_details in camera_details:
id,name,is_ip,link = one_camera_details
if is_ip == 1:
camera = Camera(name,id,frame_buffer,link,db_helper)
else:
camera = Camera(name,id,frame_buffer,int(link),db_helper)
camera.start()
camera_buffer.append(camera)
# starting the flask api which is used to pass the data to front end.
flask_thread = flask_api(frame_buffer,camera_buffer,db_helper)
flask_thread.start()