diff --git a/rbb_tools/src/rbb_tools/commands/index.py b/rbb_tools/src/rbb_tools/commands/index.py index ccdbb2e..641332b 100644 --- a/rbb_tools/src/rbb_tools/commands/index.py +++ b/rbb_tools/src/rbb_tools/commands/index.py @@ -38,6 +38,7 @@ def register_bag_file(api, store_name, file): bag.topics=[] bag.products=[] bag.extraction_failure = False + bag.in_trash = False api.put_bag_meta(store_name, bag.name, bag) @@ -64,7 +65,8 @@ def command(store_name, api): return try: - bags = api.list_bags(store_name) + bags = api.list_bags(store_name, in_trash=False) + trashed_bags = api.list_bags(store_name, in_trash=True) except Exception as e: print("Reason: " + str(e)) return @@ -74,11 +76,19 @@ def command(store_name, api): info = store.list_file(bag.store_data) bags_by_name[info.get_path()] = bag + trashed_bags_by_name = {} + for bag in trashed_bags: + info = store.list_file(bag.store_data) + trashed_bags_by_name[info.get_path()] = bag + store_files = store.list_files() for file in store_files: if file.get_name()[-3:] != "bag": continue + if file.get_path() in trashed_bags_by_name: + continue + if not file.get_path() in bags_by_name: print("NEW: %s at %s" % (file.get_save_name(), file.get_path())) register_bag_file(api, store_info.name, file)