Commit Graph

42 Commits

Author SHA1 Message Date
ske087 31ad592e98 Fix Windows player: kiosk lockdown, robust video transitions, keep-awake
- Production/kiosk mode: exit_on_escape=0, window-close guard, Ctrl+C
  ignore, Alt+F4/Alt+Tab/Win/Ctrl+Esc keyboard hook (Windows)
- Robust video playback: async (non-blocking) ffpyplayer teardown,
  video progress watchdog (advance at true clip end), EOS re-entrancy
  guard, stale-advance guard, focus keeper for foreground retention
- Resume playback timer after Settings/exit popups close
- Windows keep-awake: SetThreadExecutionState + disable screensaver/
  lock screen (restored on exit)
- Always-on playback_trace.log for diagnosing transitions
- exe metadata: app_icon.ico + version_info.txt (publisher identity)
2026-08-04 15:57:33 +03:00
ske087 a2add88f04 Fix video not advancing + media not downloading on same-version startup
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.
2026-07-24 15:43:56 +03:00
ske087 362f5096a0 Fix infinite recursion when restarting player with empty playlist
- 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
2026-07-24 09:53:29 +03:00
ske087 3845830a86 Add Windows Player support and related files
- 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
2026-07-24 08:34:00 +03:00
SKE087 39565c5761 Improve Raspberry Pi startup and Chromium transitions 2026-07-20 16:27:22 +03:00
Kiwy Signage Player f30f97683b v1.2.0 - Weblink improvements, port UI fix, Wayland transition fix
- 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
2026-06-29 20:54:44 +03:00
Kiwy Signage Player 609d9169d2 updated player for deploy from server 2026-06-29 19:59:49 +03:00
Kiwy Signage Player abbd51a787 Add weblink playlist support and fix offline playback recursion
- 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
2026-06-28 13:46:29 +03:00
Kiwy Player 11436ddeab Fix app crash: resolve DISPLAY environment and input device issues
- 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
2026-01-17 22:32:02 +02:00
Kiwy Player 30f058182c Fix: Reload playlist after edited media is uploaded to server
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!
2026-01-17 22:01:13 +02:00
Kiwy Player 120c889143 Fix app crashes: optimize Kivy window backend and SDL drivers
- 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.
2026-01-17 21:35:30 +02:00
Kiwy Player 6bf4e3735a Add comprehensive video playback optimization for smooth performance
Environment variable optimizations:
- KIVY_WINDOW='pygame' - Better window backend performance
- KIVY_AUDIO='ffpyplayer' - Optimized audio playback
- KIVY_GL_BACKEND='gl' - Use OpenGL for better graphics
- FFMPEG_THREADS='4' - Multi-threaded video decoding
- LIBPLAYER_BUFFER='2048000' - 2MB buffer for smooth playback
- SDL_AUDIODRIVER='alsa' - Better audio on Raspberry Pi

Kivy configuration optimizations:
- multisampling=0 - Disable for better performance
- fast_rgba=1 - Enable fast RGBA mode
- Stereo audio (channels=2)
- Reduced logging overhead (warning level)

Video widget enhancements:
- FFmpeg buffer optimization (2MB)
- Multi-threaded decoding (4 threads)
- Ignore index for better seeking
- Allow codec fallback
- 60 FPS animation delay

New video optimization script (.video-optimization.sh):
- GPU memory increased to 256MB
- Install video codec libraries
- Optimize swappiness to 30 (better memory management)
- CPU forced to performance mode
- Filesystem cache optimization

Installation integration:
- Runs video optimization automatically on Raspberry Pi
- Configures GPU memory, libraries, and system settings
- Improves overall video playback smoothness

This addresses video stuttering, frame drops, and playback lag
by optimizing at multiple levels: environment, application, and system.
2026-01-17 20:41:31 +02:00
Kiwy Player e735e85d3c Add Wayland display server support for power management
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
2026-01-17 20:15:47 +02:00
Kiwy Player 72a6d7e704 Add aggressive HDMI power control to prevent display shutdown
Enhanced Raspberry Pi HDMI power management:

Boot Configuration (/boot/config.txt):
- hdmi_blanking=0 - Disable HDMI blanking
- hdmi_force_hotplug=1 - Force HDMI mode always on
- hdmi_ignore_cec_init=1 - Disable HDMI CEC interference
- hdmi_ignore_edid=0xa5000080 - Disable HDMI sleep mode

New systemd services:
- hdmi-poweron.service - Runs tvservice -p every 30 seconds
- screen-keepalive.service - Aggressive display keep-alive script

Display keep-alive script (.display-keepalive.sh):
- tvservice -p - Force HDMI to stay powered
- xset commands - Keep X11 screensaver off
- xdotool - Mouse movement for activity detection
- xrandr - Disable monitor power profile saving
- 30-second loop for continuous power signaling

Enhanced app-level control (main.py):
- DISPLAY=:0 environment variable for X11 commands
- tvservice integration in signal_screen_activity()
- xrandr power profile management
- More aggressive DPMS disabling

This addresses HDMI being powered down at multiple levels:
1. Firmware level (boot config)
2. System level (systemd services)
3. X11 level (xset, xdotool, xrandr)
4. App level (continuous signaling)

HDMI output should now remain powered throughout playback.
2026-01-17 19:59:45 +02:00
Kiwy Player 8703350b23 Add screen activity signaler to prevent display sleep
- 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.
2026-01-17 19:23:15 +02:00
Kiwy Player 81432ac832 Add autostart functionality and power management for Raspberry Pi
- 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)
2026-01-17 18:50:47 +02:00
Kiwy Signage Player 1cc0eae542 Perf: Optimize playback and simplify playlist management
- Performance improvements:
  * Throttle drawing updates to 60fps (16ms intervals)
  * Optimize file I/O: use single os.stat() instead of exists+getsize
  * Reduce logger overhead: convert hot-path info logs to debug
  * Preload next media asynchronously for smoother transitions
  * Smart cache invalidation for edited images

- Simplify playlist management:
  * Remove versioning: single server_playlist.json file
  * Create nested directories for edited_media downloads
  * Recursively delete unused media and empty folders
  * Cleaner version tracking without file proliferation

- UI improvements:
  * Smoother intro-to-playlist transition
  * Fix edited media directory creation for nested paths
2025-12-14 16:57:47 +02:00
Kiwy Signage Player b2d380511a Refactor: Move UI definitions to KV file and modularize edit popup
- 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
2025-12-14 14:48:35 +02:00
Kiwy Signage Player db796e4d66 updated card check 2025-12-13 19:39:00 +02:00
ske087 02e9ea1aaa updated to monitor the netowrk and reset wifi if is not working 2025-12-10 15:53:30 +02:00
Kiwy Signage Player 4c3ddbef73 updated to correctly play the playlist and reload images after edited 2025-12-10 00:09:20 +02:00
Kiwy Signage Player 87e059e0f4 updated to corect function the play pause function 2025-12-09 18:53:34 +02:00
Kiwy Signage Player f1a84d05d5 updated buttons in settings 2025-12-08 21:52:03 +02:00
ske087 02227a12e5 updeated to read specific card 2025-12-08 15:45:37 +02:00
ske087 9d32f43ac7 Add edit feature enable/disable setting
- Added checkbox in Settings screen to enable/disable edit feature
- Setting stored in app_config.json as 'edit_feature_enabled'
- Edit workflow now validates: player setting, media type, server permission, card auth
- Shows appropriate error message when edit is blocked at any validation step
- Defaults to enabled (true) if not set
- All conditions must be met for edit interface to open
2025-12-08 14:30:12 +02:00
ske087 af1e671c7f Add USB card reader authentication for edit feature
- Implemented CardReader class to read data from USB card readers
- Added CardSwipePopup with 5-second timeout and visual feedback
- Card data is captured and included in edit metadata
- Card data sent to server when edited images are uploaded
- Added evdev dependency for USB input device handling
- Fallback mode when evdev not available (for development)
- Created test utility (test_card_reader.py) for card reader testing
- Added comprehensive documentation (CARD_READER_AUTHENTICATION.md)
- Added access-card.png icon for authentication popup
- Edit interface requires card swipe or times out after 5 seconds
2025-12-08 14:05:04 +02:00
Kiwy Signage Player 9664ad541b moved files 2025-12-06 00:12:37 +02:00
Kiwy Signage Player 89e5ad86dd Add media editing features: WebP support, edit permissions, user auth, server upload
- Migrated to get_playlists_v2 with improved auth system
- Added WebP image format support for playback and editing
- Implemented edit_on_player permission check from server playlist
- Added user authentication layer for edit function (placeholder: player_1)
- Implemented versioned saving with metadata (user, timestamp, version)
- Added server upload functionality for edited media
- Fixed playlist update after intro video completion
- Added hostname and quickconnect_code to player feedback
- Improved error handling for upload failures (non-blocking)
2025-12-06 00:07:48 +02:00
Kiwy Signage Player f573af0505 update 2025-12-05 00:36:38 +02:00
Kiwy Signage Player fba2007bdf Improve edit interface: full-screen layout with toolbars, versioned saving to edited_media folder 2025-12-05 00:25:53 +02:00
Kiwy Signage Player 72d382b96b Add image editing feature with drawing tools
- Added pencil edit button to player controls
- Created EditPopup with drawing layer for image annotation
- Drawing tools: color selection (red/blue/green/black), thickness control
- Features: undo last stroke, clear all strokes, save edited image
- Playback automatically pauses during editing
- Only images (.jpg, .jpeg, .png, .bmp) can be edited
- Edited images saved with '_edited' suffix in same directory
- Drawing layer with touch support for annotations
- Full toolbar with color, thickness, and action controls
2025-12-04 22:40:05 +02:00
Kiwy Signage Player 07b7e96edd Add custom on-screen keyboard feature and fix installation
- Added custom half-width on-screen keyboard widget (keyboard_widget.py)
- Keyboard appears at bottom center when input fields are active
- Integrated keyboard in exit popup and settings popup
- Fixed install.sh: added --break-system-packages flag for pip3
- Fixed install.sh: added fallback to online installation for version mismatches
- Removed old Kivy 2.1.0 tar.gz that was causing conflicts
- Keyboard includes close button for intuitive dismissal
- All input fields trigger keyboard on touch
- Keyboard automatically cleans up on popup dismiss
2025-12-04 22:17:57 +02:00
ske087 744681bb20 update player with wachdog and intro 2025-11-22 10:26:20 +02:00
ske087 68ed5b8534 updated player with playlist 2025-11-22 10:04:30 +02:00
ske087 3f9674517d updated player 2025-11-22 09:48:48 +02:00
ske087 493f307599 updated to play video 2025-11-21 22:46:29 +02:00
Kivy Signage Player 342331f9dd Improve video playback performance with async server communication
Changes:
- Implement async/await pattern for non-blocking server communications
- Use asyncio event loop integrated with Kivy for smooth UI
- Run playlist updates and feedback sending in thread pool
- Prevent UI freezing during network I/O operations
- Add video error handling and playback state management
- Implement delayed video playback start (wait 0.5s for loading)
- Add video error callback for better error recovery
- Cancel all async tasks on application shutdown
- Process async tasks every 100ms without blocking Kivy event loop

New file:
- convert_video_for_rpi.sh: FFmpeg script for optimizing videos (1080p @ 30fps, H.264)
2025-11-03 16:13:13 +02:00
Kivy Signage Player a2fddfa312 updated view 2025-10-27 16:46:08 +02:00
Kivy Signage Player e3831d1594 updated view 2025-10-27 14:08:27 +02:00
Kivy Signage Player 88b28a5937 update location and setting 2025-09-30 10:36:30 +03:00
Kivy Signage Player e052f4d068 first commit 2025-09-26 17:04:17 +03:00
Kivy Signage Player 04d4ea5916 Initial commit: Kivy Signage Player
- Complete Kivy-based signage player application
- Fetches playlists from DigiServer via REST API
- Supports images (JPG, PNG, GIF, BMP) and videos (MP4, AVI, MKV, MOV, WEBM)
- Modern UI with touch controls and settings popup
- Separated UI (KV file) from business logic (Python)
- Fullscreen media display with proper scaling
- Server feedback system for player status reporting
- Auto-hide controls with mouse/touch activation
- Virtual environment setup with requirements.txt
- Installation and run scripts included

Features:
 Cross-platform Kivy framework
 Server integration with DigiServer
 Media playback with duration control
 Player feedback and status reporting
 Settings management with persistent config
 Error handling and recovery
 Clean architecture with KV file separation
2025-09-26 16:48:26 +03:00