diff --git a/src/caosadvancedtools/cfood.py b/src/caosadvancedtools/cfood.py index 32703b65c98c507b39f98cb8589213df615f1d9a..c6800902a70c341e5c57363a19af249566b6176d 100644 --- a/src/caosadvancedtools/cfood.py +++ b/src/caosadvancedtools/cfood.py @@ -81,6 +81,7 @@ class AbstractCFood(object): self.crawled_file = crawled_file self.crawled_path = crawled_file.path self.match = type(self).match(crawled_file.path) + self.to_be_updated = db.Container() @staticmethod def get_re(): @@ -113,8 +114,18 @@ class AbstractCFood(object): raise NotImplementedError() def update_identifiables(self): + """ Changes the identifiables as needed and adds changed identifiables + to self.to_be_updated + """ raise NotImplementedError() + def push_identifiables_to_CaosDB(self): + """ Updates the self.to_be_updated Container, i.e. pushes the changes + to CaosDB + """ + get_ids_for_entities_with_names(self.to_be_updated) + self.to_be_updated.update() + @staticmethod # move to api? def set_parents(entity, names): diff --git a/src/caosadvancedtools/crawler.py b/src/caosadvancedtools/crawler.py index 2fe94484e7e4dc6e28cca18db359da188efba5f4..24c974b957b8ca90eece64d8a2a1a5c8c1cf9480 100644 --- a/src/caosadvancedtools/crawler.py +++ b/src/caosadvancedtools/crawler.py @@ -90,6 +90,7 @@ class Crawler(object): self.cache.insert_list(hashes, identifiables) cfood.update_identifiables() + cfood.push_identifiables_to_CaosDB() except Exception as e: print(e)