Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion rbb_tools/src/rbb_tools/commands/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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
Expand All @@ -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)
Expand Down