diff --git a/src/nte_history_exporter/console.py b/src/nte_history_exporter/console.py index c92fb41..40042c9 100644 --- a/src/nte_history_exporter/console.py +++ b/src/nte_history_exporter/console.py @@ -13,6 +13,7 @@ DIM = "\x1b[2m" CYAN = "\x1b[36m" GREEN = "\x1b[32m" YELLOW = "\x1b[33m" +BRIGHT_WHITE = "\x1b[97m" _ansi: bool | None = None @@ -91,17 +92,20 @@ def print_page_captured(label: str, page: int | None, *, recaptured: bool = Fals print(style(" + ", GREEN, BOLD) + label + style(f" {action} {page}", DIM)) -def print_missing_pages(label: str, pages: list[int], reasons: dict[int, str] | None = None) -> None: +def print_missing_pages(label: str, pages: list[int]) -> None: page_list = ", ".join(str(page) for page in pages) - print(style(" ! ", YELLOW, BOLD) + f"{label} missing page(s): {page_list}.") - if reasons: - for page in pages: - print(style(f" Page {page}: {reasons[page]}.", DIM)) - print(" Close and reopen this history board, then scroll down again.") + print(style(" ! ", YELLOW, BOLD) + style(f"{label} missing page(s): {page_list}.", YELLOW, BOLD)) + print( + style( + " Close and reopen this history board, then scroll down until page gap recovered is shown.", + BRIGHT_WHITE, + BOLD, + ) + ) def print_page_gap_recovered(label: str) -> None: - print(style(" + ", GREEN, BOLD) + f"{label} page gap recovered.") + print(style(" + ", GREEN, BOLD) + style(f"{label} page gap recovered.", GREEN, BOLD)) def print_capture_stats(received: int, dropped: int, interface_dropped: int) -> None: diff --git a/src/nte_history_exporter/live_capture/runner.py b/src/nte_history_exporter/live_capture/runner.py index 7763867..3f41f50 100644 --- a/src/nte_history_exporter/live_capture/runner.py +++ b/src/nte_history_exporter/live_capture/runner.py @@ -76,6 +76,7 @@ def run_live_capture( if capture.fallback_reason: console.print_capture_fallback(capture.fallback_reason) reported_missing_pages: dict[str, tuple[int, ...]] = {} + active_gap_notices: set[str] = set() try: with StopKeyMonitor() as stop_key: @@ -115,14 +116,12 @@ def run_live_capture( label = POOL_META.get(kind, POOL_META["permanent"])["name"] missing_pages = tuple(session.missing_pages(kind)) previously_missing = reported_missing_pages.get(kind, ()) - if missing_pages and missing_pages != previously_missing: - reasons = { - page: session.missing_page_reason(kind, page) - for page in missing_pages - } - console.print_missing_pages(label, list(missing_pages), reasons) + if missing_pages and kind not in active_gap_notices: + console.print_missing_pages(label, list(missing_pages)) + active_gap_notices.add(kind) elif previously_missing and not missing_pages: console.print_page_gap_recovered(label) + active_gap_notices.discard(kind) reported_missing_pages[kind] = missing_pages finally: stats = capture.stats()