Fix pre-existing player issues: edit upload paths, playlist sync, DPI, console

src/edit_popup.py: pass and reproduce the server-side edited-media layout
('edited_media/<media_id>/') when saving an edit, falling back to the flat
folder when no media id is available, so uploads land where the server expects.

src/get_playlists_v2.py: preserve every server field (audio, muted, description,
id, position, ...) when rewriting playlist items, instead of rebuilding fixed
dicts that silently dropped them. Web-link items keep their original http(s) url
and are never downloaded.

windows/pyi_runtime_hook.py: declare per-monitor DPI awareness before SDL/Kivy
initialise, so on a scaled display the window is not virtualised to a smaller
resolution (which left a black strip and mis-scaled media).

windows/build_win.bat: optional code signing step for PCs with Smart App Control
enabled, driven by KIWY_SIGN_PFX / KIWY_SIGN_PFX_PASSWORD or a local
kiwy_signing.pfx.

windows/build.spec, windows/README_WINDOWS_BUILD.md, windows/development-track.md:
build notes and manifest updates.
This commit is contained in:
ske087
2026-09-10 16:44:04 +03:00
parent 6dc79828bc
commit a0704efa3c
6 changed files with 228 additions and 32 deletions
+30 -2
View File
@@ -6,7 +6,7 @@
---
## 📅 Current Session — 2026-07-31
## 📅 Current Session — 2026-08-07
| Field | Value |
|-------|-------|
@@ -14,9 +14,37 @@
| **Python** | 3.12.9 — `windows\venv\` (250 MB, all deps installed) |
| **Kivy** | 2.3.1 |
| **PyInstaller** | 6.21.0 |
| **Last .exe build** | 2026-07-26 16:53 — `windows\dist\KiwySignagePlayer\KiwySignagePlayer.exe` (96 MB) |
| **Last .exe build** | 2026-08-07 08:23 — `windows\dist\KiwySignagePlayer\KiwySignagePlayer.exe` (98.8 MB) |
| **Build command** | `.\venv\Scripts\python.exe -m PyInstaller build.spec --clean --noconfirm` |
### Overnight soak test findings (2026-08-07 morning)
- **Symptom:** player froze on the last video widget (never advanced past
`video_loaded`); heartbeat stopped; 7 leaked `msedge.exe` processes left
running in the background.
- **Root cause (two compounding bugs in `run_win.py`):**
1. **Leaked browser + instant-exit handoff.** A previously leaked Chrome/Edge
process held the `.kiosk-profile` lock. The next weblink launch handed
the URL to that leaked instance and **exited in ~2s** (`07:04:57` launch →
`07:04:59 next_media_called`). The watchdog advanced instantly, so the
weblink never showed AND the leaked browser window was never killed →
`msedge.exe` processes accumulated overnight.
2. **Main-thread freeze.** The focus keeper ran heavy Win32 work
(`EnumWindows` + `AttachThreadInput` + `SetForegroundWindow` + `SendInput`)
synchronously on the Kivy thread every second. With leaked Edge windows
fighting back, this wedged the event loop → video never advanced, heartbeat
stopped (`08-07 07:09`).
- **Fix (in `run_win.py`, rebuilt 08:23):**
1. New `_windows_kill_browsers_on_profile()` — scans `chrome/msedge/chromium`
command lines (WMIC, PowerShell fallback), taskkills any browser holding
the `.kiosk-profile` lock. Called **before every weblink launch**.
2. Watchdog now has `MIN_ALIVE_BEFORE_EARLY_ADVANCE = 8s` — an instant
(~2s) handoff exit no longer advances/skips the weblink.
3. `_bring_kivy_to_front(async_ok=True)` runs the heavy Win32 bring-to-front
on a **background worker thread** guarded by a lock, so the Kivy main
thread is never blocked. Synchronous `async_ok=False` still available for
explicit transitions.
### 📋 Cross-platform audit — Linux commands → Windows handling
Every Linux-only command in `src/` was cross-referenced against the patches