def loaddb(self, db_id, fname) -> int: if imgdb.resetdb(db_id): logger.warn('Load is replacing existing database id:' + str(db_id)) dbSpace = DBSpace(db_id) self.db_spaces[db_id] = dbSpace dbSpace.file_name = fname if not imgdb.loaddb(db_id, fname): logger.error("Error loading image database") del self.db_spaces[db_id] return None # adjust last added image id logger.info('| Database loaded: ' + str(dbSpace)) dbSpace.last_id = self.get_img_count(dbSpace.id) + 1 return db_id
def resetdb(self, db_id) -> bool: if imgdb.resetdb(db_id): # succeeded self.db_spaces[db_id] = DBSpace(db_id) logger.debug("resetdb() ok") return True return False