benbusby / piro

A Raspberry Pi security camera rover
MIT License
100 stars 17 forks source link

Recordings fail when raztot/app/static/captures/ doesn't exist #4

Closed ewegene closed 5 years ago

ewegene commented 5 years ago

The captures output directory doesn't exist by default. When trying to create a recording it fails:

[raztot-streaming] New video stream! (ssrc=2945139143, index 0)
Setting pipeline to PAUSED ...
ERROR: Pipeline doesn't want to pause.
ERROR: from element /GstPipeline:pipeline0/GstFileSink:filesink0: Could not open file "/home/pi/raztot/app/static/captures/2019-06-04-23_57_11.mp4" for writing.
Additional debug info:
gstfilesink.c(438): gst_file_sink_open_file (): /GstPipeline:pipeline0/GstFileSink:filesink0:
system error: No such file or directory
Setting pipeline to NULL ...
Freeing pipeline ...

Additionally, when trying to view a list of the recordings it also fails:

[2019-06-04 23:58:51,425] ERROR in app: Exception on /static/captures/ [GET]
Traceback (most recent call last):
  File "/root/raztot/venv/lib/python3.5/site-packages/flask/app.py", line 2311, in wsgi_app
    response = self.full_dispatch_request()
  File "/root/raztot/venv/lib/python3.5/site-packages/flask/app.py", line 1834, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/root/raztot/venv/lib/python3.5/site-packages/flask/app.py", line 1737, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/root/raztot/venv/lib/python3.5/site-packages/flask/_compat.py", line 36, in reraise
    raise value
  File "/root/raztot/venv/lib/python3.5/site-packages/flask/app.py", line 1832, in full_dispatch_request
    rv = self.dispatch_request()
  File "/root/raztot/venv/lib/python3.5/site-packages/flask/app.py", line 1818, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/root/raztot/venv/lib/python3.5/site-packages/flask_login/utils.py", line 261, in decorated_view
    return func(*args, **kwargs)
  File "/root/raztot/app/routes.py", line 222, in list_captures
    files = os.listdir(CAPTURES_FOLDER)
FileNotFoundError: [Errno 2] No such file or directory: '/root/raztot/app/static/captures'