From 1d664524eb61557311a26246354ed0ca16a9191b Mon Sep 17 00:00:00 2001 From: Patrick Robertson Date: Wed, 12 Mar 2025 11:54:25 +0000 Subject: [PATCH] Add info on last check/last updated to the metadata --- .../opentimestamps_enricher/opentimestamps_enricher.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/auto_archiver/modules/opentimestamps_enricher/opentimestamps_enricher.py b/src/auto_archiver/modules/opentimestamps_enricher/opentimestamps_enricher.py index cdeb78d..cf110a2 100644 --- a/src/auto_archiver/modules/opentimestamps_enricher/opentimestamps_enricher.py +++ b/src/auto_archiver/modules/opentimestamps_enricher/opentimestamps_enricher.py @@ -1,6 +1,5 @@ import os -import hashlib -from typing import TYPE_CHECKING +import datetime from loguru import logger import opentimestamps @@ -108,7 +107,7 @@ class OpentimestampsEnricher(Enricher): # Create media for the timestamp file timestamp_media = Media(filename=timestamp_path) # explicitly set the mimetype, normally .ots files are 'application/vnd.oasis.opendocument.spreadsheet-template' - media.mimetype = "application/vnd.opentimestamps" + timestamp_media.mimetype = "application/vnd.opentimestamps" timestamp_media.set("opentimestamps_version", opentimestamps.__version__) # Verify the timestamp if needed @@ -158,12 +157,14 @@ class OpentimestampsEnricher(Enricher): # Process different types of attestations if isinstance(attestation, PendingAttestation): - info["type"] = f"pending (as of {attestation.date})" + info["type"] = f"pending" info["uri"] = attestation.uri elif isinstance(attestation, BitcoinBlockHeaderAttestation): info["type"] = "bitcoin" info["block_height"] = attestation.height + + info["last_check"] = datetime.datetime.now().isoformat()[:-7] attestation_info.append(info) @@ -178,5 +179,6 @@ class OpentimestampsEnricher(Enricher): else: result["verified"] = False result["pending"] = False + result["last_updated"] = datetime.datetime.now().isoformat()[:-7] return result \ No newline at end of file