fix: [retro hunt] fix object to resume
Some checks are pending
CI / ail_test (3.10) (push) Waiting to run
CI / ail_test (3.7) (push) Waiting to run
CI / ail_test (3.8) (push) Waiting to run
CI / ail_test (3.9) (push) Waiting to run

This commit is contained in:
terrtia 2025-01-17 15:14:54 +01:00
parent 4d5c3f002b
commit e0a8f4cc37
No known key found for this signature in database
GPG key ID: 1E1B1F50D84613D0
4 changed files with 36 additions and 23 deletions

View file

@ -454,6 +454,7 @@ def get_all_decodeds_objects(filters={}):
mimetypes = sorted(mimetypes)
if filters.get('start'):
if filters['start']['type'] == 'decoded':
_, start_id = filters['start'].split(':', 1)
decoded = Decoded(start_id)
# remove sources
@ -466,6 +467,8 @@ def get_all_decodeds_objects(filters={}):
i += 1
else:
start_id = None
else:
start_id = None
d_dir = get_decodeds_dir()
for mimetype in mimetypes:

View file

@ -464,8 +464,12 @@ def get_all_items_objects(filters={}):
sources = get_all_sources()
sources = sorted(sources)
if filters.get('start'):
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
@ -478,6 +482,9 @@ def get_all_items_objects(filters={}):
else:
start_id = None
start_date = None
else:
start_id = None
start_date = None
# date
if date_from and date_to:

View file

@ -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):

View file

@ -72,6 +72,8 @@ class Retro_Hunt_Module(AbstractModule):
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
@ -81,8 +83,7 @@ class Retro_Hunt_Module(AbstractModule):
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):