Replaces the Windows port with a Raspberry Pi / Linux implementation on
Raspberry Pi OS "Trixie" (Debian 13, aarch64, Wayland/labwc). The Windows
code is removed here but preserved on the Windows-Player branch.
Entry point
-----------
linux/run_linux.py replaces windows/run_win.py. src/main.py stays
platform-neutral; all Pi-specific behaviour is injected from linux/.
Five bugs that prevented the port (all measured on real hardware)
----------------------------------------------------------------
1. Kivy's PyPI wheel bundles an SDL2 built WITHOUT the wayland driver, so
no window could be created (Trixie has no X server). linux/fix_kivy_sdl2.sh
symlinks the system SDL2 over the bundled filename.
2. SDL2 requires WAYLAND_DISPLAY to be *set* - the socket alone is not enough,
unlike wlopm. This broke every systemd/cron/autostart launch.
linux_display.ensure_session_environment() detects and exports it.
3. Kivy's Clock resolves callbacks via func.__name__; a patch assigned under a
different name crashed the player ~20s after a successful start.
4. The inherited signal_screen_activity() shelled out to tvservice, xdotool and
ydotool - none exist on Trixie - and mis-escaped 'wlopm --on \*', so the
display blanked after 10 minutes.
5. The launchers ran src/main.py directly, bypassing every platform patch and
resolving the data directory one level too high.
Web links
---------
- --ozone-platform-hint=auto does NOT fall back to Wayland on Chromium 152; it
aborts. The platform is now chosen explicitly.
- The keyring password prompt is suppressed via the ENVIRONMENT, not the flags:
launch_env() strips DBUS_SESSION_BUS_ADDRESS for the child so Chromium cannot
reach gnome-keyring-daemon.
- Teardown kills the whole process group (needs start_new_session=True);
previously it silently fell back to terminate() and orphaned children.
Video normalisation
-------------------
A 4K video cannot play on a Pi 4: ffpyplayer decodes in software, measured at
0.90x realtime (1080p is 3.03x). Oversized media is downscaled to 1920x1080 at
sync time using the hardware h264_v4l2m2m encoder (~31s for an 18s clip),
triggered by resolution only so already-playable files are untouched.
src/media_state.py owns the shared on-disk contract: a .kiwy-converting marker
makes the player skip the item while it is being rebuilt, then the converted
file is played instead. If nothing is playable at all (a single-item playlist
whose only video is converting), the player loops the intro video rather than
leaving a blank screen.
Also fixed
----------
- network_monitor: replaced netsh/ifconfig/dhclient with nmcli (Trixie uses
NetworkManager; ifconfig and dhclient are not even installed).
- Removed the Windows-only focus keeper/guardian from main.py.
- main.py: duplicate SDL_AUDIODRIVER setdefault (a silent no-op); Settings
"Test connection" now uses tempfile.gettempdir().
- config/app_config.json: credentials blanked so a fresh clone runs the
first-run setup flow.
Verification
------------
linux/test_media_state.py 18/18, test_linux_patches.py 21/21,
test_linux_browser_flags.py 27/27. Verified live against a real DigiServer:
image -> weblink -> image -> video with correct durations, zero leaked Chromium
processes, and no throttling over a 10 minute monitored run.
- Rebuilt evdev wheel for cp313 aarch64 (was missing from repo)
- Updated install.sh: add --system-site-packages to venv, verify imports
- Updated start.sh: activate .venv before running player
- Updated run_player.sh: activate .venv before running player
- Added pip fallback for kivy/ffpyplayer if apt/pip install misses them
- Replaced all cp311 wheels with cp313 wheels for Python 3.13 compatibility
- Added new dependency wheels: aiohappyeyeballs, evdev, ffpyplayer
- Rebuilt install.sh with virtual environment + offline wheel installation
- Added --sudo-user/-U and --sudo-password/-W CLI arguments
- Added run_sudo() helper to avoid password prompts during installation
- Fixed 'Setting Up Player Directories' hang (cat->stdin) by using touch
- Updated start.sh to activate virtual environment before running player
- Updated run_player.sh to activate virtual environment
- Removed old cp311 incompatible wheels
- Added backup of previous install.sh as install.sh.bak
- Fix: Replace broad pkill with PID-specific kill -9 in start.sh
- Fix: Remove unreachable deactivate call in start.sh
- Fix: Add find_boot_config helper for RPi config file detection
- Fix: Update autostart status message (remove fake systemd service claim)
- Fix: Add ACTUAL_USER/ACTUAL_HOME to power management function
- Add: Auto-reboot at end of install.sh with 5s cancel window
- Add: Ctrl+C cleanup trap during installation
- Added configure_display_resolution() function to force 1920x1080 output
- Supports three methods: xrandr (X11), tvservice (RPi native), /boot/config.txt (persistent)
- Ensures player displays Full HD on screens larger than 1920x1080
- Configuration runs automatically on each startup
- Fixed start.sh environment variable loading from systemctl
- Use here-document (<<<) instead of pipe for subshell to preserve exports
- Added better error handling for evdev device enumeration
- Added exception handling in intro video playback with detailed logging
- App now properly initializes with DISPLAY=:0 and WAYLAND_DISPLAY=wayland-0
- Commented out forced pygame backend (causes issues with display initialization)
- Added SDL_VIDEODRIVER and SDL_AUDIODRIVER fallback chains (wayland,x11,dummy)
- Limited KIVY_INPUTPROVIDERS to wayland,x11 (avoids problematic input providers)
- Reduced FFMPEG_THREADS from 4 to 2 (conserves Raspberry Pi resources)
- Reduced LIBPLAYER_BUFFER from 2MB to 1MB (saves memory)
- Fixed asyncio event loop deprecation warning (use try/except for get_running_loop)
- Better exception handling for cursor hiding
These changes fix the app crashing after 30 seconds due to graphics provider issues.
Features:
- Automatically activates .venv virtual environment
- Creates venv if it doesn't exist
- Installs dependencies on first run
- Checks for configuration file
- Changes to project directory automatically
- Deactivates venv on exit
Usage:
bash start.sh
Updated README with new recommended startup method.