kopia lustrzana https://github.com/bellingcat/auto-archiver
Add info on last check/last updated to the metadata
rodzic
394b8b2dd1
commit
1d664524eb
|
@ -1,6 +1,5 @@
|
||||||
import os
|
import os
|
||||||
import hashlib
|
import datetime
|
||||||
from typing import TYPE_CHECKING
|
|
||||||
|
|
||||||
from loguru import logger
|
from loguru import logger
|
||||||
import opentimestamps
|
import opentimestamps
|
||||||
|
@ -108,7 +107,7 @@ class OpentimestampsEnricher(Enricher):
|
||||||
# Create media for the timestamp file
|
# Create media for the timestamp file
|
||||||
timestamp_media = Media(filename=timestamp_path)
|
timestamp_media = Media(filename=timestamp_path)
|
||||||
# explicitly set the mimetype, normally .ots files are 'application/vnd.oasis.opendocument.spreadsheet-template'
|
# 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__)
|
timestamp_media.set("opentimestamps_version", opentimestamps.__version__)
|
||||||
|
|
||||||
# Verify the timestamp if needed
|
# Verify the timestamp if needed
|
||||||
|
@ -158,12 +157,14 @@ class OpentimestampsEnricher(Enricher):
|
||||||
|
|
||||||
# Process different types of attestations
|
# Process different types of attestations
|
||||||
if isinstance(attestation, PendingAttestation):
|
if isinstance(attestation, PendingAttestation):
|
||||||
info["type"] = f"pending (as of {attestation.date})"
|
info["type"] = f"pending"
|
||||||
info["uri"] = attestation.uri
|
info["uri"] = attestation.uri
|
||||||
|
|
||||||
elif isinstance(attestation, BitcoinBlockHeaderAttestation):
|
elif isinstance(attestation, BitcoinBlockHeaderAttestation):
|
||||||
info["type"] = "bitcoin"
|
info["type"] = "bitcoin"
|
||||||
info["block_height"] = attestation.height
|
info["block_height"] = attestation.height
|
||||||
|
|
||||||
|
info["last_check"] = datetime.datetime.now().isoformat()[:-7]
|
||||||
|
|
||||||
attestation_info.append(info)
|
attestation_info.append(info)
|
||||||
|
|
||||||
|
@ -178,5 +179,6 @@ class OpentimestampsEnricher(Enricher):
|
||||||
else:
|
else:
|
||||||
result["verified"] = False
|
result["verified"] = False
|
||||||
result["pending"] = False
|
result["pending"] = False
|
||||||
|
result["last_updated"] = datetime.datetime.now().isoformat()[:-7]
|
||||||
|
|
||||||
return result
|
return result
|
Ładowanie…
Reference in New Issue