while True loop for recording

This commit is contained in:
Fabio Manganiello 2018-07-01 19:35:23 +02:00
parent 6ba71b52e7
commit 7ad0724f0e

View file

@ -118,23 +118,24 @@ class CameraPiBackend(Backend):
while True: while True:
self.camera.wait_recording(2) self.camera.wait_recording(2)
else: else:
connection = self.server_socket.accept()[0].makefile('wb') while True:
self.logger.info('Accepted client connection on port {}'. connection = self.server_socket.accept()[0].makefile('wb')
format(self.listen_port)) self.logger.info('Accepted client connection on port {}'.
format(self.listen_port))
try:
self.camera.start_recording(connection, format=format)
while True:
self.camera.wait_recording(2)
except ConnectionError:
self.logger.info('Client closed connection')
try: try:
self.stop_recording() self.camera.start_recording(connection, format=format)
connection.close() while True:
except: self.camera.wait_recording(2)
pass except ConnectionError:
self.logger.info('Client closed connection')
try:
self.stop_recording()
connection.close()
except:
pass
self.send_camera_action(self.CameraAction.START_RECORDING) self.send_camera_action(self.CameraAction.START_RECORDING)
self._recording_thread = None self._recording_thread = None