feat(notify): configurable plain/html summary formatting #64

Merged
jblu merged 1 commits from dev-notification-format into main 2026-11-02 01:13:23 -06:00
Owner

Rework the Pushover/Apprise summary so it reads as a report instead of a dump of counters.

Changes

  • Single builder. build_summary() is now the one source of truth for both notifiers, removing the duplicated body string and the stray leading indentation caused by backslash line continuations.
  • format option: plain (aligned columns) or html (bold labels, sets html=1 for Pushover). Apprise always receives the plain body since it has no HTML support.
  • use_emoji for emoji-prefixed rows.
  • Title states the outcome (qbit-maid: 7 torrents removed) instead of --- qbit-maid summary ---.
  • Dry-run safety: says Would remove when delete_torrents = false, so a dry run is never mistaken for a real deletion.
  • Runtime formatted as 12s / 1m 04s / 1h 02m 03s instead of a timedelta with microseconds.
  • New options: include_hostname, notify_on_empty, priority, sound, retry, expire.
  • Failures are logged, not raised, so a Pushover outage can't abort a run.

Example

qbit-maid: 7 torrents removed

Scanned 42 torrents in 12s

Removed          7
Orphaned         4
Ignored          5
Premature        3

Protected       10
Non-protected   20

Compatibility

All new config keys are optional and defaulted, so existing config.toml files keep working unchanged.

Tests

51 tests pass (python3 -m unittest test_qbitmaid test_write_csv), 24 of them new — covering all four style/emoji combinations, both delete_torrents states, runtime formatting, notify_on_empty, priority/retry/expire handling, error swallowing, and that Apprise never receives HTML.

Rework the Pushover/Apprise summary so it reads as a report instead of a dump of counters. ## Changes - **Single builder.** `build_summary()` is now the one source of truth for both notifiers, removing the duplicated body string and the stray leading indentation caused by backslash line continuations. - **`format` option:** `plain` (aligned columns) or `html` (bold labels, sets `html=1` for Pushover). Apprise always receives the plain body since it has no HTML support. - **`use_emoji`** for emoji-prefixed rows. - **Title states the outcome** (`qbit-maid: 7 torrents removed`) instead of `--- qbit-maid summary ---`. - **Dry-run safety:** says `Would remove` when `delete_torrents = false`, so a dry run is never mistaken for a real deletion. - **Runtime** formatted as `12s` / `1m 04s` / `1h 02m 03s` instead of a timedelta with microseconds. - **New options:** `include_hostname`, `notify_on_empty`, `priority`, `sound`, `retry`, `expire`. - **Failures are logged**, not raised, so a Pushover outage can't abort a run. ## Example ``` qbit-maid: 7 torrents removed Scanned 42 torrents in 12s Removed 7 Orphaned 4 Ignored 5 Premature 3 Protected 10 Non-protected 20 ``` ## Compatibility All new config keys are optional and defaulted, so existing `config.toml` files keep working unchanged. ## Tests 51 tests pass (`python3 -m unittest test_qbitmaid test_write_csv`), 24 of them new — covering all four style/emoji combinations, both `delete_torrents` states, runtime formatting, `notify_on_empty`, priority/retry/expire handling, error swallowing, and that Apprise never receives HTML.
jblu added 1 commit 2026-10-27 10:28:31 -05:00
feat(notify): configurable plain/html summary formatting
test / komodo-deploy-script (push) Successful in 17s
test / komodo-deploy-script (pull_request) Successful in 16s
ci / docker (push) Successful in 2m2s
881765cdf5
Rework the Pushover/Apprise summary so it reads as a report instead of a
dump of counters.

- Extract build_summary() as the single source of truth for both notifiers,
  removing the duplicated body string and the stray leading indentation
  caused by backslash line continuations.
- Add a 'format' option: 'plain' (aligned columns) or 'html' (bold labels,
  sets html=1 for Pushover). Apprise always receives the plain body.
- Add 'use_emoji' for emoji-prefixed rows.
- Title now states the outcome ('7 torrents removed') instead of
  '--- qbit-maid summary ---'.
- Say 'Would remove' when delete_torrents is false, so a dry run is never
  mistaken for a real deletion.
- Format runtime as 12s / 1m 04s instead of a timedelta with microseconds.
- Add include_hostname, notify_on_empty, priority, sound, retry and expire.
- Log notification failures instead of letting them abort the run.
- Cover the new formatting with unit tests; document the options in the
  README and config.toml.example.
jblu merged commit 1caa346a7c into main 2026-11-02 01:13:23 -06:00
jblu deleted branch dev-notification-format 2026-11-02 01:13:23 -06:00
Sign in to join this conversation.