Ejemplo n.º 1
0
    def __archive_cameras(self, cams, result_path):
        """
        Archives images from array of cameras.  Places directory of all results at the given path.
        """
        camera_handlers = []
        for camera in cams:
            # Create a new thread to handle the camera.
            camera_handler = CameraHandler(camera, result_path)
            # Run the thread.
            camera_handler.start()
            # Add the thread to the array of threads.
            camera_handlers.append(camera_handler)

            # Sleep to shift the starting time of all the threads.
            # time.sleep(interval / len(cams)) # Old
            time.sleep(0.5)

        # Wait for all the threads to finish execution.
        for camera_handler in camera_handlers:
            camera_handler.join()