Release 0.9.0 watcher alerts

This commit is contained in:
scootz 2026-05-01 14:56:53 +01:00
parent b98690b7d8
commit 10c05d7b60
5 changed files with 86 additions and 29 deletions

104
README.md
View file

@ -1,4 +1,4 @@
# Anti Prestige Tool v0.7.6 # Anti Prestige Tool v0.9.0
Queue-position reader for Arma Reforger on Linux Wayland. Queue-position reader for Arma Reforger on Linux Wayland.
@ -30,30 +30,98 @@ make
No sudo install step is required. No sudo install step is required.
## Use ## Standard Run
Run: Watch the selected Reforger window and alert when the queue position reaches `5` or lower:
```bash
uv run reforger_queue_read.py --watch --portal-window
```
On first run, your desktop should show a window-sharing picker. Select the Arma Reforger window. Later runs try to reuse that selection.
Read the queue once:
```bash
uv run reforger_queue_read.py --portal-window
```
Force the window picker again if the saved selection is stale or wrong:
```bash
uv run reforger_queue_read.py --portal-window --portal-reselect
```
Run once with crop and OCR details while tuning or checking accuracy:
```bash ```bash
uv run reforger_queue_read.py --portal-window --show-crop --debug uv run reforger_queue_read.py --portal-window --show-crop --debug
``` ```
On first run, your desktop should show a window-sharing picker. Select the Arma Reforger window. If the portal grants persistence, the tool stores a restore token here: The saved portal restore token lives here:
```text ```text
~/.local/state/anti-prestige-tool/portal-window-restore-token ~/.local/state/anti-prestige-tool/portal-window-restore-token
``` ```
Later runs try to reuse that token: ## Watch Behavior
```bash Default watch mode:
uv run reforger_queue_read.py --portal-window --show-crop --debug
```text
poll interval: 15 seconds
alert threshold: 5, inclusive
alerts: once per newly detected position
notification urgency: critical
``` ```
Force a fresh picker if the saved selection is wrong or stale: Each poll prints a timestamp, the detected queue number, and whether an alert fired:
```text
2026-05-01T14:44:05+01:00 number=5 alert=yes
2026-05-01T14:44:20+01:00 number=5 alert=no
```
If no digits are found, the watcher logs that and keeps running.
## Optional Flags
Common flags:
```text
--watch keep polling instead of reading once
--watch-interval SECONDS poll delay; default 15
--alert-threshold N alert when position is <= N; default 5
--portal-reselect ignore the saved portal selection and pick again
--show-crop print the resolved crop
--debug print OCR match details
--save-input PATH save the captured portal frame
--notify-command COMMAND notification command; default notify-send
```
Input and test flags:
```text
--image PATH read an existing screenshot
--dataset DIR read every image in a dataset directory
--expect-filenames compare dataset results to numeric filenames
--font FONT debug with synthetic font templates
--crop X,Y,W,H override the crop
--cropped treat input image as already cropped
```
## Examples
Alert at queue position `10` or lower:
```bash ```bash
uv run reforger_queue_read.py --portal-window --portal-reselect --show-crop --debug uv run reforger_queue_read.py --watch --portal-window --alert-threshold 10
```
Poll every 5 seconds:
```bash
uv run reforger_queue_read.py --watch --portal-window --watch-interval 5
``` ```
Save the captured input image while debugging: Save the captured input image while debugging:
@ -62,20 +130,16 @@ Save the captured input image while debugging:
uv run reforger_queue_read.py --portal-window --save-input /tmp/apt-portal-window.png --show-crop --debug uv run reforger_queue_read.py --portal-window --save-input /tmp/apt-portal-window.png --show-crop --debug
``` ```
Watch the selected window and send a desktop notification once for each newly detected queue position under 5: Test watcher alerting against a fixture without sending a real notification:
```bash ```bash
uv run reforger_queue_read.py --watch --portal-window uv run reforger_queue_read.py --watch --image datasets/regression-test-set/3.png --watch-interval 1 --notify-command true
``` ```
Watch mode polls every 15 seconds by default. It prints each poll result with a timestamp, the detected number, and whether an alert fired. Queue position `1` is sent as a critical notification; positions `2`, `3`, and `4` use normal urgency. Read an existing screenshot:
Useful watcher overrides:
```bash ```bash
uv run reforger_queue_read.py --watch --portal-window --watch-interval 5 uv run reforger_queue_read.py --image /path/to/screenshot.png --show-crop --debug
uv run reforger_queue_read.py --watch --portal-window --alert-threshold 10
uv run reforger_queue_read.py --watch --image datasets/regression-test-set/3.png --watch-interval 1 --notify-command true
``` ```
## Validation ## Validation
@ -109,12 +173,6 @@ datasets/scootz-dataset/2160x1440.png 24
## Debug Options ## Debug Options
Read an existing screenshot:
```bash
uv run reforger_queue_read.py --image /path/to/screenshot.png --show-crop --debug
```
The default matcher uses bundled templates from: The default matcher uses bundled templates from:
```text ```text

View file

@ -1,6 +1,6 @@
[project] [project]
name = "anti-prestige-tool" name = "anti-prestige-tool"
version = "0.7.6" version = "0.9.0"
description = "Arma Reforger queue-position reader for Linux Wayland" description = "Arma Reforger queue-position reader for Linux Wayland"
readme = "README.md" readme = "README.md"
requires-python = ">=3.10" requires-python = ">=3.10"

View file

@ -158,7 +158,7 @@ def main():
"--alert-threshold", "--alert-threshold",
type=int, type=int,
default=5, default=5,
help="In watch mode, notify for detected queue positions strictly below this number.", help="In watch mode, notify for detected queue positions at or below this number.",
) )
parser.add_argument( parser.add_argument(
"--notify-command", "--notify-command",

View file

@ -13,13 +13,12 @@ NOTIFY_TITLE = "Arma Reforger Queue"
def notify_queue_position(notify_command, position): def notify_queue_position(notify_command, position):
urgency = "critical" if position == 1 else "normal"
command = [ command = [
*shlex.split(notify_command), *shlex.split(notify_command),
"-a", "-a",
APP_NAME, APP_NAME,
"-u", "-u",
urgency, "critical",
NOTIFY_TITLE, NOTIFY_TITLE,
f"Queue position is {position}", f"Queue position is {position}",
] ]
@ -46,7 +45,7 @@ def queue_position(number):
def should_alert(number, threshold, notified_positions): def should_alert(number, threshold, notified_positions):
position = queue_position(number) position = queue_position(number)
if position is None or position >= threshold or position in notified_positions: if position is None or position > threshold or position in notified_positions:
return None return None
return position return position

2
uv.lock generated
View file

@ -4,5 +4,5 @@ requires-python = ">=3.10"
[[package]] [[package]]
name = "anti-prestige-tool" name = "anti-prestige-tool"
version = "0.7.6" version = "0.9.0"
source = { virtual = "." } source = { virtual = "." }