systemd files, documentation and a bug fix
Change-Id: I66e34059e0c1d604b82fba558bfeadee2ace093c
diff --git a/person_detection/app.py b/person_detection/app.py
index 0ed28eb..2ef9b87 100644
--- a/person_detection/app.py
+++ b/person_detection/app.py
@@ -3,8 +3,6 @@
SPDX-FileCopyrightText: 2020-present Open Networking Foundation <info@opennetworking.org>
SPDX-License-Identifier: LicenseRef-ONF-Member-1.01
"""
-from importlib import import_module
-import os
import logging as log
import sys
import flask
@@ -24,6 +22,7 @@
log.info("{} - connected".format(flask.request.remote_addr))
return flask.render_template('index.html', devices=config.cameras)
+
def gen(camera):
"""Video streaming generator function."""
while True:
@@ -31,6 +30,7 @@
yield (b'--frame\r\n'
b'Content-Type: image/jpeg\r\n\r\n' + frame + b'\r\n')
+
@app.route('/video_feed/<device>')
def video_feed(device):
"""Video streaming route. Put this in the src attribute of an img tag."""
@@ -38,11 +38,13 @@
log.debug("{} - video feed {}".format(flask.request.remote_addr, device))
camera = Camera(device, flask.request.remote_addr, args)
return flask.Response(gen(camera),
- mimetype='multipart/x-mixed-replace; boundary=frame')
+ mimetype='multipart/x-mixed-replace; boundary=frame')
+
def name_to_port(name):
return int(name)
+
def build_argparser():
parser = ArgumentParser(add_help=False)
args = parser.add_argument_group('Options')
@@ -75,17 +77,17 @@
help = "ROC password",
type = str)
args.add_argument("--mbrlow",
- help = "Low range of MBR",
- default = 7000000,
- type = int)
+ help="Low range of MBR",
+ default=7000000,
+ type=int)
args.add_argument("--mbrhigh",
- help = "High range of MBR",
- default = 10000000,
- type = int)
+ help="High range of MBR",
+ default=10000000,
+ type=int)
args.add_argument("--devicegroup",
- help = "Camera device group",
- default = "menlo-4g-cameras",
- type = str)
+ help="Camera device group",
+ default="menlo-4g-cameras",
+ type=str)
return parser
@@ -104,7 +106,7 @@
key = args.key
if key is None:
if args.user is not None and args.password is not None:
- roc = Roc(args.user, args.password)
+ roc = Roc(config.url, args.user, args.password, config.enterprise, config.site)
key = roc.get_key()
else:
log.error("Either key or user/password required")