- src/player_auth.json, player_auth.json: refreshed player credentials. The
untracked root copy is now added to version control.
- playlists/server_playlist.json: latest synced playlist state.
- windows/archive_list.txt, windows/build_last.txt: build output, committed by
request.
SECURITY: these files contain live player credentials (auth_code, player_id,
server_url). Anyone who can read the repository can use them. Consider rotating
the auth code and removing the credential files from version control.
- windows/win_card_reader.py: Windows-native card reader via the Raw Input API
with a low-level keyboard-hook fallback.
- windows/sign_exe.ps1: sign the built executable with a .pfx certificate.
- windows/create_self_signed_cert.ps1: generate a self-signed cert for local
testing (not trusted by Smart App Control).
- windows/verify_sendinput_fix.py: verification helper for the SendInput
foreground-unlock fix in run_win.py.
- documentation/CODE_SIGNING_SMART_APP_CONTROL.md: signing guidance.
- working_files/execute_playlist_retrieve.py,
working_files/raw_server_playlist.json: playlist retrieval diagnostics.
Note: windows/archive_list.txt and windows/build_last.txt are build output and
were committed by request rather than by convention.
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.
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.
Web links were implemented three times (main.py subprocess, run_win.py
subprocess + Win32 overlay, cef_browser.py embedded CEF), each owning its own
process handle, watchdog and teardown. That ambiguity caused leaked browsers,
skipped items, lost foreground and blank screens when a page failed to load.
Replace all three with a single owner in src/weblink_session.py:
- WeblinkSession: validate -> launch -> verify -> watch -> teardown.
Generation-tokened so stale callbacks are ignored, idempotent close(),
atexit-safe, never more than one browser alive.
- WeblinkAdapter: the only platform-specific part (launch / wait_visible /
is_alive / teardown / prewarm). Platform layers inject engines through
SignagePlayer.weblink_adapter_factory.
- ChromiumSubprocessAdapter: default engine (Pi chromium, Windows chrome/msedge).
- InteractionWatcher: decides when an item is finished.
- WebInputSources: /dev/input/event* (Linux) plus a GetCursorPos pointer tap
(needed on Windows for embedded CEF, which has no child process).
Interaction model: web links are an interactive surface, not timed media.
The player advances only when the configured duration has elapsed AND the
viewer has not interacted for 10s, measured from the most recent interaction.
A touch in the final seconds of a slot therefore pushes the advance 10s past
that touch, and each further touch pushes it again, so a page is never pulled
out from under someone using it. An untouched page still advances on schedule.
A drag burst counts as one interaction but the countdown tracks its last event,
so an item cannot be cut off mid-gesture. max_dwell (duration x factor, floored
by min_max_dwell) is an absolute backstop against a wedged browser or a jammed
touchscreen.
Verified start-up: the visibility wait runs on the watcher thread, never on
Kivy's main thread. If the browser window never appears the item is reported
failed and skipped, instead of resetting the error counter and leaving a black
screen up for the whole duration.
Config: new "weblink" block in config/app_config.json (engine,
interaction_postpone, interaction_debounce, interaction_grace,
max_dwell_factor, min_max_dwell, launch_timeout, prewarm) with safe defaults,
so an absent block still works.
Also add weblink_session to the PyInstaller hiddenimports so the frozen exe
bundles the new module.
- Added kivy.lib.gstplayer to excluded_imports (we use ffpyplayer)
- Added all cefpython3_py{27,34-311}.pyd to excluded_imports
- Removes ~300 lines of library-not-found warnings from build output
- Reduces .exe size from 143 MB to 96 MB
v1 created a separate Win32 window — same problem as external Chrome.
v2 creates CEF as a CHILD WINDOW of Kivy's SDL_app window:
- No separate taskbar entry
- No z-order fighting (CEF is INSIDE Kivy)
- No desktop flash
- CEF message loop pumped via Kivy Clock (main thread)
- Resize handler attached so CEF follows Kivy window changes
- build.spec includes cef_browser in hidden imports
- delete_unused_media: normalize Windows backslashes to forward slashes
when comparing with playlist file_name (fixes file deleted after download)
- update_playlist_if_needed: download media even when playlist version matches
- _on_video_eos: now schedules next_media() — was an empty stub
BUG-009: _on_video_eos was empty (stub). Added Clock.schedule_once
for next_media() when video reaches end of stream.
BUG-008: download_media_files only ran when server_version >
local_version. Added download check in up-to-date branch so media
files are synced even when playlist version hasn't changed.
Windows-specific fixes:
- _windows_play_weblink: uses --start-maximized + --app=URL for true fullscreen
- Shows black Win32 overlay before opening/closing Chrome to mask desktop
- _windows_kill_process_tree: uses taskkill /F /T to kill all Chrome child processes
- _Win32Overlay class: fullscreen borderless always-on-top black window
- Updated README to note Python 3.12 requirement and local data dir behavior
- Added empty playlist guard in play_current_media() to return
early instead of calling restart_playlist()
- Added empty playlist guard in restart_playlist() to return
early instead of calling play_current_media()
- Wrapped SettingsPopup content in ScrollView so fields
are not cut off on smaller screens
- New windows/ directory with build scripts, specs, and configuration
- Windows-specific requirements (requirements_win.txt)
- Launch and runtime scripts for Windows (run_win.py, launch_player.bat)
- PyInstaller build configuration (build.spec)
- Updated .gitignore to exclude windows/venv312/
- Updated config and source files for Windows compatibility
- Moved working_files to proper directory
- 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
- Add Port field to Settings UI (was hidden in config, not editable)
- Fix double-port bug: skip appending :port if server_ip already contains one
- Weblink: replace --kiosk with --start-fullscreen (fixes Wayland/Labwc
window restoration after Chromium closes)
- Weblink: inactivity watchdog - advance to next media only after N seconds
of no touch (instead of fixed timer)
- Weblink: detect Chromium process exit and advance immediately
- Weblink: pre-warm Chromium in hidden off-screen window during previous
media item to eliminate cold-start delay on transition
- Weblink: Wayland-safe hide/show transition - hide content_area before
Chromium, 200ms delay after kill before showing next media
- Chromium flags: suppress GNOME keyring popup (--password-store=basic)
- Suppress --disable-sync, --disable-background-networking dialogs
- get_playlists_v2: pass through weblink items without download, preserve type
- main.py: render weblink items fullscreen via Chromium kiosk overlay with cleanup on next/pause/stop
- main.py: fix unbounded recursion when playlist media is missing/invalid by scheduling retries via Clock (keeps standard playlist cycling offline)
- docs: add PLAYER_WEBLINK_INTEGRATION.md
- 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
- Removed 6 duplicate cron entries that were spawning multiple instances
- Enabled systemd kiwy-player.service for proper startup management
- Service is now the single source of truth for app startup
- App runs stably with proper DISPLAY environment from systemd
- 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
Issue: Player crashes after 2-3 minutes during editing
Hypothesis: The background upload thread may be interfering with playback
even with the Clock.schedule_once fix.
Action: Temporarily disable the background upload to see if this is
the root cause of the crashes.
Edits will still be saved locally, just not uploaded to server during
this diagnostic test.
If player is stable without this thread, the issue is in the upload
logic or thread management.
BUG: Background upload thread was crashing the app
Problem:
- _upload_to_server() runs in daemon thread
- Was directly setting self.player.should_refresh_playlist from thread
- Kivy is NOT thread-safe for direct state modifications
- App crashed after 2-3 minutes during editing
Root cause:
Line 503: self.player.should_refresh_playlist = True
This directly modified Kivy object state from non-main thread
Caused race conditions and memory corruption
Solution:
- Use Clock.schedule_once() to schedule flag update on main thread
- Ensures all Kivy state modifications happen on main thread
- Thread-safe and proper Kivy API usage
- No more app crashes during editing
This was causing the app to crash every 10-20 seconds during edits.
Should now be stable!
CRITICAL FIX - This was the main issue preventing edited images from appearing!
Problem:
- Edited media was being uploaded to server successfully
- Server updated the playlist (new version returned: 34)
- BUT player never reloaded the playlist
- So edited images stayed invisible until restart
Solution:
1. EditPopup now sets should_refresh_playlist flag when upload succeeds
2. Main player checks this flag in check_playlist_and_play()
3. When flag is set, player immediately reloads playlist
4. Edited media appears instantly without needing restart
Testing:
- Created diagnostic script test_edited_media_upload.py
- Confirmed server accepts edited media and returns new playlist version
- Verified SSL fix works correctly (verify=False)
Now edited images should appear immediately after save!
Root cause identified from logs:
[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate
The server uses a self-signed certificate (like production), but the edited media
upload endpoint was not disabling SSL verification while other API calls do.
Solution:
- Add verify=False to requests.post() call in _upload_to_server()
- Matches the SSL verification handling in get_playlists_v2.py
- Add warning about SSL verification being disabled
- Now edited images can upload successfully to server
This fixes the upload failures that were preventing edited images from being
synced to the server.
Critical fixes for image editing workflow:
1. Keep local edited files as backup (don't delete after server upload)
- Server may not process upload immediately
- Keeps edits safe locally in case server fails
- Prevents loss of edited images
2. Include original filename in metadata sent to server
- Server needs to know which file was edited
- Allows proper tracking and versioning
3. Improved error logging for server upload
- Now logs detailed errors (404, 401, timeout, connection)
- Shows clear messages when server doesn't support endpoint
- Helps diagnose why edits aren't syncing to server
4. Better user feedback during save
- Shows 'Saved to device' status first
- Then 'Upload in progress' to show server sync happening
- Clarifies local vs server save status
Bug symptoms fixed:
- Edited images now persist locally after restart
- Server upload now sends correct file information
- Clear error messages if server upload fails
- User understands 'local save' vs 'server sync' steps
- 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.
- Replaced failing systemd user service with system-wide service
- System service more reliable on Wayland/Bookworm systems
- Service creates /etc/systemd/system/kiwy-player.service
- Runs as pi user with proper display environment variables
- Adds Restart=on-failure for robustness
- Keeps XDG and cron methods as additional fallback layers
This resolves autostart failures after recent system updates.
Added support for both X11 and Wayland environments:
Display Server Detection:
- Auto-detects Wayland via WAYLAND_DISPLAY environment variable
- Falls back to X11 commands if not Wayland
- Works seamlessly on both display servers
Wayland-specific tools:
- wlopm - Wayland output power management (keeps display on)
- wlr-randr - Output management for wlroots compositors
- ydotool - Mouse movement for Wayland (alternative to xdotool)
- systemd-inhibit integration for idle prevention
Enhanced display keep-alive script:
- Detects display server type on startup
- Uses appropriate commands based on environment
- Wayland: wlopm, wlr-randr, ydotool
- X11: xset, xdotool, xrandr
- Both: tvservice for HDMI power control
App-level improvements (main.py):
- Detects Wayland via os.environ check
- Executes Wayland-specific commands when detected
- Maintains X11 compatibility for older systems
Installation improvements:
- Auto-installs Wayland tools if Wayland is detected
- Attempts to install: wlopm, wlr-randr, ydotool
- Graceful fallback if packages unavailable
This ensures HDMI power management works correctly on:
- Raspberry Pi OS with X11 (older versions)
- Raspberry Pi OS with Wayland (Bookworm and newer)
- Any Linux system using either display server
- Added signal_screen_activity() method to SignagePlayer class
- Runs every 20 seconds automatically
- Also triggered on any touch/user input events
Multiple methods used to keep display awake:
- xset s reset - Resets screensaver timer
- xset dpms force on - Forces display on
- xdotool - Subtle mouse movement to trigger activity
This complements the system-level power management:
- Works alongside display power management settings
- Non-blocking and non-critical (fails gracefully)
- Signals every 20 seconds + on user input
- Prevents display from sleeping during playback
Screen should now remain active throughout media playback.
- Created .keep-screen-alive.sh wrapper script with multiple methods:
* systemd-inhibit (primary - prevents OS-level sleep/suspend)
* xset commands (prevents X11 screensaver)
* Mouse movement (prevents idle timeout)
- Added screen-keepalive.service systemd unit:
* Runs xset s reset every 30 seconds
* Auto-restarts on failure
* Integrated with graphical session
- Multiple layers of screen protection:
* HDMI blanking disabled
* CPU power saving disabled
* System sleep/suspend disabled
* X11 screensaver disabled
* DPMS (Display Power Management) disabled
* Display forced on periodically
Screen will now remain active while player is running, preventing lockups or blank screens during playback.
- Enhanced install.sh with comprehensive autostart workflow:
* XDG autostart entry (desktop environment)
* systemd user service (most reliable)
* LXDE autostart support (Raspberry Pi OS)
* Cron fallback (@reboot)
* Terminal mode enabled for debugging
- Added Raspberry Pi power management features:
* Disable HDMI screen blanking
* Prevent CPU power saving (performance mode)
* Disable system sleep/suspend
* X11 screensaver disabled
* Display power management (DPMS) disabled
- Fixed sudo compatibility:
* Properly detects actual user when run with sudo
* Correct file ownership for user configs
* systemctl --user works correctly
- Player launches in terminal for error visibility
- Autostart configured to use start.sh (watchdog with auto-restart)
- Modified ssl_utils.py to treat 404 errors as expected when server doesn't have /api/certificate endpoint
- Changed verify_ssl setting to false in app_config.json to allow HTTPS connections without certificate verification
- This allows the player to connect to servers that don't implement the certificate endpoint
- Created src/edit_popup.py module for EditPopup and DrawingLayer classes
- Moved EditPopup UI definition to signage_player.kv (reduced main.py by 533 lines)
- Moved CardSwipePopup UI definition to signage_player.kv (reduced main.py by 41 lines)
- Improved code organization with better separation of concerns
- main.py reduced from 2,384 to 1,811 lines (24% reduction)
- All functionality preserved, no breaking changes