Loading openflexure_microscope/api/app.py +8 −1 Original line number Diff line number Diff line Loading @@ -103,8 +103,15 @@ app.register_blueprint(task_blueprint, url_prefix=uri('/task', 'v1')) def cleanup(): global api_microscope logging.debug("App teardown started...") # Save config if api_microscope.rc: api_microscope.rc.save(backup=True) # Update capture DB and metadata files before exiting if api_microscope.camera: api_microscope.camera.store_captures() # Close down the microscope api_microscope.close() logging.debug("App teardown complete.") Loading openflexure_microscope/camera/base.py +12 −0 Original line number Diff line number Diff line Loading @@ -278,6 +278,18 @@ class BaseCamera(object): else: return [] def store_captures(self): # Save metadata files for image in self.images: image.save_metadata() for video in self.videos: video.save_metadata() # Update capture database self.save_capture_db(self.images, self.images_db) self.save_capture_db(self.videos, self.videos_db) # CREATING NEW CAPTURES def shunt_captures(self, target_list: list): Loading openflexure_microscope/camera/capture.py +4 −0 Original line number Diff line number Diff line Loading @@ -50,6 +50,9 @@ def capture_from_dict(capture_dict): if 'custom' in capture_dict['metadata']: capture._metadata = capture_dict['metadata']['custom'] if 'tags' in capture_dict['metadata']: capture.tags = capture_dict['metadata']['tags'] capture.file = capture_dict['metadata']['path'] capture.split_file_path(capture.file) Loading Loading @@ -246,6 +249,7 @@ class CaptureObject(object): """ if not tag in self.tags: self.tags.append(tag) self.save_metadata() def delete_tag(self, tag: str): """ Loading Loading
openflexure_microscope/api/app.py +8 −1 Original line number Diff line number Diff line Loading @@ -103,8 +103,15 @@ app.register_blueprint(task_blueprint, url_prefix=uri('/task', 'v1')) def cleanup(): global api_microscope logging.debug("App teardown started...") # Save config if api_microscope.rc: api_microscope.rc.save(backup=True) # Update capture DB and metadata files before exiting if api_microscope.camera: api_microscope.camera.store_captures() # Close down the microscope api_microscope.close() logging.debug("App teardown complete.") Loading
openflexure_microscope/camera/base.py +12 −0 Original line number Diff line number Diff line Loading @@ -278,6 +278,18 @@ class BaseCamera(object): else: return [] def store_captures(self): # Save metadata files for image in self.images: image.save_metadata() for video in self.videos: video.save_metadata() # Update capture database self.save_capture_db(self.images, self.images_db) self.save_capture_db(self.videos, self.videos_db) # CREATING NEW CAPTURES def shunt_captures(self, target_list: list): Loading
openflexure_microscope/camera/capture.py +4 −0 Original line number Diff line number Diff line Loading @@ -50,6 +50,9 @@ def capture_from_dict(capture_dict): if 'custom' in capture_dict['metadata']: capture._metadata = capture_dict['metadata']['custom'] if 'tags' in capture_dict['metadata']: capture.tags = capture_dict['metadata']['tags'] capture.file = capture_dict['metadata']['path'] capture.split_file_path(capture.file) Loading Loading @@ -246,6 +249,7 @@ class CaptureObject(object): """ if not tag in self.tags: self.tags.append(tag) self.save_metadata() def delete_tag(self, tag: str): """ Loading