Commit Graph

52 Commits

Author SHA1 Message Date
Kiwy Player
9b58f6b63d Fix: disable SSL verification for edited media server upload
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.
2026-01-17 21:53:07 +02:00
Kiwy Player
eeb2a61ef7 Fix image editing bug: ensure edits persist and upload correctly
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
2026-01-17 21:44:39 +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
d1382af517 updated sh files 2026-01-17 21:00:49 +02:00
Kiwy Player
3531760e16 Fix autostart for Wayland: use system-wide service instead of user service
- 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.
2026-01-17 20:58:39 +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
17ae5439bd Add screen keep-alive functionality to prevent display sleep
- 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.
2026-01-17 19:02:00 +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 Player
c5bf6c1eaf Fix: Handle HTTPS certificate endpoint 404 gracefully
- 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
2026-01-16 22:25:59 +02:00
Kiwy Signage Player
1c02843687 removed chck point from saved media file 2025-12-14 19:07:44 +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
Kiwy Signage Player
5843bb5215 renamed card checked 2025-12-13 19:09:06 +02:00
2b42999008 aded card check 2025-12-13 17:05:49 +00:00
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
46d9fcf6e3 delete watch dog 2025-12-08 21:52:13 +02:00
Kiwy Signage Player
f1a84d05d5 updated buttons in settings 2025-12-08 21:52:03 +02:00
Kiwy Signage Player
706af95557 deleted unnecesary files 2025-12-08 18:17:09 +02:00
02227a12e5 updeated to read specific card 2025-12-08 15:45:37 +02:00
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
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
744681bb20 update player with wachdog and intro 2025-11-22 10:26:20 +02:00
68ed5b8534 updated player with playlist 2025-11-22 10:04:30 +02:00
3f9674517d updated player 2025-11-22 09:48:48 +02:00
493f307599 updated to play video 2025-11-21 22:46:29 +02:00
da1d515cc5 updated 2025-11-21 22:20:23 +02:00
4d803d4fe9 updated files 2025-11-21 22:20:06 +02:00
Kivy Signage Player
dbc1f51e9a updated player 2025-11-13 21:01:14 +02:00
Kivy Signage Player
9f957bbd5d updated get playlist function 2025-11-12 16:06:48 +02:00
Kivy Signage Player
96f9118362 Add start.sh script for easy startup with virtual environment
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.
2025-11-03 16:57:40 +02:00
Kivy Signage Player
18e826311c Add offline installation quick start guide 2025-11-03 16:36:40 +02:00
Kivy Signage Player
4ce41b7ccc Add offline installation support with repo folder and updated dependencies
Features:
- Create repo/ folder structure for offline packages
  - python-wheels/ for Python packages (.whl files)
  - system-packages/ for APT packages and .deb files
- Add download_offline_packages.sh to populate Python wheels
- Add download_deb_packages.sh to download system .deb packages
- Update install.sh with smart online/offline detection
  - Auto-detects repo folder and uses offline packages
  - Falls back to online installation if repo is empty
  - Supports --offline flag for explicit offline mode
- Update requirements.txt with async dependencies:
  - aiohttp==3.9.1 for async HTTP client
  - asyncio==3.4.3 for async I/O framework
- Add OFFLINE_INSTALLATION.md with complete guide
- Add .gitignore to exclude downloaded packages from repo
- Document all system dependencies in apt-packages.txt

Downloaded packages:
- 18 Python wheels with all dependencies
- Total size: ~50 MB for Python packages
- Ready for offline deployment
2025-11-03 16:29:03 +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
bb33743729 saved info 2025-10-01 09:54:37 +03: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