Refactor player and Windows wrapper onto WeblinkSession

src/main.py:
- Delegate web-link playback to WeblinkSession (get_weblink_session), with
  on_finished / on_failed callbacks driving the transition.
- Remove the in-file Chromium subprocess launching, the /dev/input watchdog and
  the pre-warm implementation; keep thin deprecated shims for platform code.
- Add _item_is_weblink(), which also accepts type aliases and the
  "no file extension + http(s) url" shape so a slightly different server
  payload is not treated as a missing media file.
- Replace the 1.0s wall-clock advance guard with a generation token
  (next_media's _token plus _schedule_advance). The old window silently dropped
  deliberate fast transitions such as weblink -> weblink; the token still
  discards stale/duplicated callbacks.
- toggle_pause is now a no-op while a web link is active: a web link is an
  interactive surface, so pause/play does not apply to it and can no longer cut
  a viewer's session short. Pause still works for images and videos.
- Preload/prewarm the next item through the session.
- _get_browser_target_size uses the real window size instead of hardcoding a
  1920x1080 fallback.

windows/run_win.py:
- Replace the Windows play_weblink override, watchdog, kill_weblink_after_frame,
  play_current_media wrapper and prewarm override with adapter injection via
  weblink_adapter_factory.
- _WinCefAdapter: embedded CEF, preferred (no subprocess, no z-order fights).
  Binds the Kivy resize handler once instead of rebinding a new closure every
  weblink cycle, which grew the callback list without bound.
- _WinChromeAdapter: Chrome/Edge subprocess with a real HWND visibility check,
  so a hand-off or a page that never paints is detected instead of leaving a
  black screen. Teardown keeps the required order (hide overlay, then raise
  Kivy) to avoid handing foreground to Explorer.
- Delete the now-dead _hide_overlay_when_chrome_ready and
  _bring_chrome_to_front. The former leaked a Clock.schedule_interval on every
  weblink cycle.
This commit is contained in:
ske087
2026-09-10 16:43:45 +03:00
parent a19627885c
commit 6dc79828bc
2 changed files with 1310 additions and 725 deletions
+485 -362
View File
File diff suppressed because it is too large Load Diff