Compare commits

..

No commits in common. "master" and "v0.7.6" have entirely different histories.

5 changed files with 28 additions and 85 deletions

102
README.md
View file

@ -1,4 +1,4 @@
# Anti Prestige Tool v0.9.0
# Anti Prestige Tool v0.7.6
Queue-position reader for Arma Reforger on Linux Wayland.
@ -30,98 +30,30 @@ make
No sudo install step is required.
## Standard Run
## Use
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:
Run:
```bash
uv run reforger_queue_read.py --portal-window --show-crop --debug
```
The saved portal restore token lives here:
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:
```text
~/.local/state/anti-prestige-tool/portal-window-restore-token
```
## Watch Behavior
Default watch mode:
```text
poll interval: 15 seconds
alert threshold: 5, inclusive
alerts: once per newly detected position
notification urgency: critical
```
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:
Later runs try to reuse that token:
```bash
uv run reforger_queue_read.py --watch --portal-window --alert-threshold 10
uv run reforger_queue_read.py --portal-window --show-crop --debug
```
Poll every 5 seconds:
Force a fresh picker if the saved selection is wrong or stale:
```bash
uv run reforger_queue_read.py --watch --portal-window --watch-interval 5
uv run reforger_queue_read.py --portal-window --portal-reselect --show-crop --debug
```
Save the captured input image while debugging:
@ -130,16 +62,20 @@ 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
```
Test watcher alerting against a fixture without sending a real notification:
Watch the selected window and send a desktop notification once for each newly detected queue position under 5:
```bash
uv run reforger_queue_read.py --watch --image datasets/regression-test-set/3.png --watch-interval 1 --notify-command true
uv run reforger_queue_read.py --watch --portal-window
```
Read an existing screenshot:
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.
Useful watcher overrides:
```bash
uv run reforger_queue_read.py --image /path/to/screenshot.png --show-crop --debug
uv run reforger_queue_read.py --watch --portal-window --watch-interval 5
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
@ -173,6 +109,12 @@ datasets/scootz-dataset/2160x1440.png 24
## 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:
```text

View file

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

View file

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

View file

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

2
uv.lock generated
View file

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