Multiple cameras partially working

Change-Id: I27279ef2e3c302946fb25c2a0c5eb32e9279d6b2
diff --git a/person_detection/app.py b/person_detection/app.py
index 13e7abc..5e3a5c7 100644
--- a/person_detection/app.py
+++ b/person_detection/app.py
@@ -8,7 +8,7 @@
 if os.environ.get('CAMERA'):
     Camera = import_module('camera_' + os.environ['CAMERA']).Camera
 else:
-    #from camera import Camera
+    # from camera import Camera
     from person_detection import Camera
 
 # Raspberry Pi camera module (requires picamera package)
@@ -20,7 +20,7 @@
 @app.route('/')
 def index():
     """Video streaming home page."""
-    return render_template('index.html')
+    return render_template('index.html', devices=[0, 1])
 
 
 def gen(camera):
@@ -30,14 +30,17 @@
         yield (b'--frame\r\n'
                b'Content-Type: image/jpeg\r\n\r\n' + frame + b'\r\n')
 
-
-@app.route('/video_feed')
-def video_feed():
+@app.route('/video_feed/<device>')
+def video_feed(device):
     """Video streaming route. Put this in the src attribute of an img tag."""
-    camera = Camera(args)
+    global args
+    camera = Camera(int(device), args)
     return Response(gen(camera),
                     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')
@@ -61,6 +64,7 @@
 
     return parser
 
+
 if __name__ == '__main__':
     args = build_argparser().parse_args()
     app.run(host='0.0.0.0', threaded=True)