Skip to content

Commit

Permalink
fix: [retro hunt] fix object to resume
Browse files Browse the repository at this point in the history
  • Loading branch information
Terrtia committed Jan 17, 2025
1 parent 4d5c3f0 commit e0a8f4c
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 23 deletions.
23 changes: 13 additions & 10 deletions bin/lib/objects/Decodeds.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,16 +454,19 @@ def get_all_decodeds_objects(filters={}):
mimetypes = sorted(mimetypes)

if filters.get('start'):
_, start_id = filters['start'].split(':', 1)
decoded = Decoded(start_id)
# remove sources
start_mimetype = decoded.get_mimetype()
i = 0
while start_mimetype and len(mimetypes) > i:
if mimetypes[i] == start_mimetype:
mimetypes = mimetypes[i:]
start_mimetype = None
i += 1
if filters['start']['type'] == 'decoded':
_, start_id = filters['start'].split(':', 1)
decoded = Decoded(start_id)
# remove sources
start_mimetype = decoded.get_mimetype()
i = 0
while start_mimetype and len(mimetypes) > i:
if mimetypes[i] == start_mimetype:
mimetypes = mimetypes[i:]
start_mimetype = None
i += 1
else:
start_id = None
else:
start_id = None

Expand Down
29 changes: 18 additions & 11 deletions bin/lib/objects/Items.py
Original file line number Diff line number Diff line change
Expand Up @@ -464,17 +464,24 @@ def get_all_items_objects(filters={}):
sources = get_all_sources()
sources = sorted(sources)
if filters.get('start'):
_, start_id = filters['start'].split(':', 1)
item = Item(start_id)
# remove sources
start_source = item.get_source()
i = 0
while start_source and len(sources) > i:
if sources[i] == start_source:
sources = sources[i:]
start_source = None
i += 1
start_date = item.get_date()
if filters['start']['type'] == 'item':
_, start_id = filters['start'].split(':', 1)
item = Item(start_id)
if not item.exists():
start_id = None
start_date = None
# remove sources
start_source = item.get_source()
i = 0
while start_source and len(sources) > i:
if sources[i] == start_source:
sources = sources[i:]
start_source = None
i += 1
start_date = item.get_date()
else:
start_id = None
start_date = None
else:
start_id = None
start_date = None
Expand Down
2 changes: 2 additions & 0 deletions bin/lib/objects/ail_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,8 @@ def obj_iterator(obj_type, filters):
return chats_viewer.get_ocrs_iterator(filters=filters)
elif obj_type == 'title':
return Titles.Titles().get_iterator()
else:
return []


def card_objs_iterators(filters):
Expand Down
5 changes: 3 additions & 2 deletions bin/trackers/Retro_Hunt.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ def compute(self, task_uuid):
last_obj = self.retro_hunt.get_last_analyzed()
if last_obj:
last_obj_type, last_obj_subtype, last_obj_id = last_obj.split(':', 2)
if last_obj_subtype is None:
last_obj_subtype = ''
else:
last_obj_type = None
last_obj_subtype = None
Expand All @@ -81,8 +83,7 @@ def compute(self, task_uuid):
self.update_progress()

if last_obj_type:
filters['start'] = f'{last_obj_subtype}:{last_obj_id}'
last_obj_type = None
filters['start'] = {'type': last_obj_type, 'subtype': last_obj_subtype, 'id': last_obj_id}

for obj_type in filters:
for obj in ail_objects.obj_iterator(obj_type, filters):
Expand Down

0 comments on commit e0a8f4c

Please sign in to comment.