From 1bc0884db29af43b3e59ba508b6b37faa7332714 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Brunner?= Date: Wed, 7 Jun 2023 11:49:29 +0200 Subject: [PATCH] Add start time messages --- scan_to_paperless/process.py | 3 +++ scan_to_paperless/status.py | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/scan_to_paperless/process.py b/scan_to_paperless/process.py index 972ac9c9..be53c365 100755 --- a/scan_to_paperless/process.py +++ b/scan_to_paperless/process.py @@ -3,6 +3,7 @@ """Process the scanned documents.""" import argparse +import datetime.datetime import glob import json import logging @@ -1787,6 +1788,8 @@ def main() -> None: sys.exit() print("Welcome to scanned images document to paperless.") + print(f"Started at: {datetime.datetime.now().strftime('%Y-%m-%d %H:%M')}") + print_waiting = True status = scan_to_paperless.status.Status() status.update() diff --git a/scan_to_paperless/status.py b/scan_to_paperless/status.py index 96c6905b..4df05da5 100644 --- a/scan_to_paperless/status.py +++ b/scan_to_paperless/status.py @@ -21,6 +21,7 @@ def __init__(self, no_write: bool = False) -> None: self._file = os.path.join(os.environ.get("SCAN_SOURCE_FOLDER", "status.html")) self._status: Dict[str, _Folder] = {} self._global_status = "Starting..." + self._start_time = datetime.datetime.utcnow().replace(microsecond=0) def set_global_status(self, status: str) -> None: """Set the global status.""" @@ -66,6 +67,7 @@ def write(self) -> None: if self.no_write: return + print(f"Write status to {self._file}") with open(self._file, "w", encoding="utf-8") as status_file: status_file.write( f""" @@ -100,6 +102,9 @@ def write(self) -> None:

Scan to Paperless status

{self._global_status}

+

Started at:

Generated at: