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)
This commit is contained in:
Kiwy Player
2026-01-17 18:50:47 +02:00
parent c5bf6c1eaf
commit 81432ac832
14 changed files with 1948 additions and 41 deletions

View File

@@ -685,6 +685,8 @@ class SettingsPopup(Popup):
screen_name = self.ids.screen_input.text.strip()
quickconnect = self.ids.quickconnect_input.text.strip()
port = self.player.config.get('port', '443')
use_https = self.player.config.get('use_https', True)
verify_ssl = self.player.config.get('verify_ssl', True)
if not all([server_ip, screen_name, quickconnect]):
Clock.schedule_once(lambda dt: self.update_connection_status(
@@ -699,13 +701,13 @@ class SettingsPopup(Popup):
if port and port != '443' and port != '80':
server_url = f"{server_ip}:{port}"
else:
protocol = "https" if port == "443" else "http"
protocol = "https" if use_https else "http"
server_url = f"{protocol}://{server_ip}:{port}"
Logger.info(f"SettingsPopup: Testing connection to {server_url}")
Logger.info(f"SettingsPopup: Testing connection to {server_url} (HTTPS: {use_https}, Verify SSL: {verify_ssl})")
# Create temporary auth instance (don't save)
auth = PlayerAuth('/tmp/temp_auth_test.json')
auth = PlayerAuth('/tmp/temp_auth_test.json', use_https=use_https, verify_ssl=verify_ssl)
# Try to authenticate
success, error = auth.authenticate(
@@ -951,16 +953,18 @@ class SignagePlayer(Widget):
self.config = json.load(f)
Logger.info(f"SignagePlayer: Configuration loaded from {self.config_file}")
else:
# Create default configuration
# Create default configuration with HTTPS support
self.config = {
"server_ip": "localhost",
"port": "5000",
"port": "443",
"screen_name": "kivy-player",
"quickconnect_key": "1234567",
"max_resolution": "auto"
"max_resolution": "auto",
"use_https": True,
"verify_ssl": True
}
self.save_config()
Logger.info("SignagePlayer: Created default configuration")
Logger.info("SignagePlayer: Created default configuration with HTTPS enabled")
except Exception as e:
Logger.error(f"SignagePlayer: Error loading config: {e}")
self.show_error(f"Failed to load configuration: {e}")
@@ -1053,7 +1057,8 @@ class SignagePlayer(Widget):
data = json.load(f)
self.playlist = data.get('playlist', [])
self.playlist_version = data.get('version', 0)
# Check for both 'version' and 'playlist_version' keys (for backward compatibility)
self.playlist_version = data.get('version', data.get('playlist_version', 0))
Logger.info(f"SignagePlayer: Loaded playlist v{self.playlist_version} with {len(self.playlist)} items")