def synch_db(cls): """Updates the database with images found in the image directory.""" if not cls.is_synch_db(): return # Deal with images not in the database first cls.images_not_in_db() for image in cls.__not_in_db__: logging.info("Adding image: " + image.getPath() + " to database.") model_image = Image(**image.toImageDbMap()) Image.addImage(model_image) ImageFile.populateParts(image) for part in image.getPartitions(): Partition.addPart(Partition(**part.toPartDbMap(model_image.id))) for image in cls.__not_on_disk__: logging.warn("Image: " + image.path + " appears to have been deleted from disk.")