segmenter: fix ecotaxa export again

(cherry picked from commit 253408b5a8156171f5853ed1420f63ebcac0dc7b)
This commit is contained in:
Romain Bazile 2021-06-08 16:16:18 +02:00 committed by Romain Bazile
parent 328d227b8f
commit 8436ac2926
2 changed files with 5 additions and 4 deletions

View file

@ -601,7 +601,8 @@ class SegmenterProcess(multiprocessing.Process):
# Publish the object_id to via MQTT to Node-RED # Publish the object_id to via MQTT to Node-RED
self.segmenter_client.client.publish( self.segmenter_client.client.publish(
"status/segmenter", f'{{"status":"Segmenting image {filename}"}}' "status/segmenter",
f'{{"status":"Segmenting image {filename}, image {i+1}/{images_count}"}}',
) )
# we recalculate the flat if the heuristics detected we should # we recalculate the flat if the heuristics detected we should
@ -696,7 +697,7 @@ class SegmenterProcess(multiprocessing.Process):
self.__working_obj_path, self.__working_obj_path,
keep_files=True, keep_files=True,
): ):
logger.succes("Ecotaxa archive export completed for this folder") logger.success("Ecotaxa archive export completed for this folder")
else: else:
logger.error("The ecotaxa export could not be completed") logger.error("The ecotaxa export could not be completed")
else: else:

View file

@ -241,13 +241,13 @@ def ecotaxa_export(archive_filepath, metadata, image_base_path, keep_files=False
# add the tsv to the archive # add the tsv to the archive
archive.writestr( archive.writestr(
"export_ecotaxa.tsv", "ecotaxa_export.tsv",
io.BytesIO( io.BytesIO(
tsv_content.to_csv(sep="\t", encoding="utf-8", index=False).encode() tsv_content.to_csv(sep="\t", encoding="utf-8", index=False).encode()
).read(), ).read(),
) )
if keep_files: if keep_files:
tsv_file = os.path.join(image_base_path, "export_ecotaxa.tsv") tsv_file = os.path.join(image_base_path, "ecotaxa_export.tsv")
tsv_content.to_csv( tsv_content.to_csv(
path_or_buf=tsv_file, sep="\t", encoding="utf-8", index=False path_or_buf=tsv_file, sep="\t", encoding="utf-8", index=False
) )