Make the app cross-platform and add a Windows build

- paths: per-platform detection behind an injectable Env. Windows finds
  Player.log in the user profile and the install via Steam (registry),
  the standalone installer, Epic, or the uninstall registry. App dirs
  come from platformdirs (unchanged XDG locations on Linux).
- logtail: open Player.log only while reading, so Windows can still
  rotate it when MTGA restarts.
- carddb: on Windows read a private copy of the card database so MTGA's
  updater can replace the original.
- App icon (SVG source + generated ICO/PNG), Windows taskbar identity,
  and a Windows-safe timer glyph.
- PyInstaller spec, launcher and PowerShell build script producing a
  one-folder windowed build and zip.
- Tests for path detection, the log follower and the card-DB copy;
  README covers Windows usage, building and per-OS locations.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Aeth3randClaude Opus 5.5 committed 2026-10-16 13:06:19 -04:00
1 parent 171fc64ca9
commit e82f8d1858
19 files changed
+685 -54

No files matched your search

+38 -6
View File
@@ -33,22 +33,34 @@ Card names, mana costs and types come from MTGA's own local card database, so th
## Requirements
- MTGA installed through Steam (Proton). The log, install and card DB are auto-detected from your
Steam library folders.
Runs on **Linux** and **Windows**.
- **Detailed logs enabled** in MTGA: *Options → Account → Detailed Logs (Plugin Support)*.
- [uv](https://docs.astral.sh/uv/) (`pacman -S uv`).
- MTGA's log, install folder and card database are auto-detected:
- Linux: MTGA through Steam (Proton), found via your Steam library folders.
- Windows: Steam, Epic Games or the standalone Wizards installer. The log is always in
`%USERPROFILE%\AppData\LocalLow\Wizards Of The Coast\MTGA\Player.log`.
- To run from source: [uv](https://docs.astral.sh/uv/) (`pacman -S uv` on Arch;
`winget install astral-sh.uv` on Windows).
## Running
From source (any OS):
```sh
uv run mtga-assistant # follow the live Player.log
uv run mtga-assistant --replay path/to/Player-prev.log --rate 40 # replay a saved log
uv run pytest # tests
```
On Windows you can instead use the packaged build: unzip `MTGA-Assistant-windows.zip` and run
`MTGA Assistant.exe`.
Start it before or after MTGA: on startup it reads the existing log to catch up on a match in
progress, then follows new lines. When MTGA restarts and replaces the log, the tracker resets.
### Linux desktop integration
On Wayland the window's app id is `mtga-assistant`. For example, to keep it floating on another
workspace in Hyprland:
@@ -57,18 +69,38 @@ windowrule = float, class:^(mtga-assistant)$
windowrule = workspace 2, class:^(mtga-assistant)$
```
### Building the Windows app
PyInstaller can't cross-compile, so build on Windows (with uv installed):
```powershell
powershell -ExecutionPolicy Bypass -File packaging\build_windows.ps1
```
This produces `dist\MTGA Assistant\MTGA Assistant.exe` and `dist\MTGA-Assistant-windows.zip`.
The same spec builds a Linux bundle when run on Linux
(`uv run --group build pyinstaller packaging/mtga-assistant.spec`). After editing
`assets/icon.svg`, regenerate the icons with `uv run python packaging/make_icon.py`.
## Configuration
Optional: `~/.config/mtga-assistant/config.toml`
Optional `config.toml`:
| | Config file | History | Image cache |
|---|---|---|---|
| Linux | `~/.config/mtga-assistant/config.toml` | `~/.local/share/mtga-assistant/` | `~/.cache/mtga-assistant/` |
| Windows | `%APPDATA%\mtga-assistant\config.toml` | `%LOCALAPPDATA%\mtga-assistant\` | `%LOCALAPPDATA%\mtga-assistant\Cache\` |
```toml
log_path = "/path/to/Player.log" # override auto-detection
mtga_dir = "/path/to/steamapps/common/MTGA"
mtga_dir = "/path/to/MTGA" # the folder containing MTGA_Data
cache_max_mb = 500 # image cache cap
history_max_mb = 300 # cap for stored game details (summaries are always kept)
```
Game history lives in `~/.local/share/mtga-assistant/history.db` (roughly 20–100 KB per game).
Game history is stored in `history.db` (roughly 20–100 KB per game). On Windows the app reads a
private copy of MTGA's card database (kept in the cache folder, about 260 MB) so that MTGA's
updater is never blocked by the app holding the file open.
## Image cache