Compare commits

...

2 Commits

Author SHA1 Message Date
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
5 changed files with 160 additions and 33 deletions

1
.player_stop_requested Normal file
View File

@@ -0,0 +1 @@
User requested exit via password

View File

@@ -1,7 +1,7 @@
{
"server_ip": "digiserver",
"port": "80",
"screen_name": "rpi-tvholba1",
"server_ip": "digi-signage.moto-adv.com",
"port": "443",
"screen_name": "tv-terasa",
"quickconnect_key": "8887779",
"orientation": "Landscape",
"touch": "True",

View File

@@ -1126,8 +1126,8 @@ class SettingsPopup(Popup):
self.ids.edit_enabled_checkbox.active = self.player.config.get('edit_feature_enabled', True)
# Update status info
self.ids.playlist_info.text = f'Playlist Version: {self.player.playlist_version}'
self.ids.media_count_info.text = f'Media Count: {len(self.player.playlist)}'
self.ids.playlist_info.text = f'Playlist: v{self.player.playlist_version}'
self.ids.media_count_info.text = f'Media: {len(self.player.playlist)}'
self.ids.status_info.text = f'Status: {"Playing" if self.player.is_playing else "Paused" if self.player.is_paused else "Idle"}'
# Bind to dismiss event to manage cursor visibility and resume playback
@@ -1267,6 +1267,93 @@ class SettingsPopup(Popup):
else:
self.ids.connection_status.color = (1, 0, 0, 1) # Red
def reset_player_auth(self):
"""Reset player authentication by deleting player_auth.json"""
try:
auth_file = os.path.join(os.path.dirname(__file__), 'player_auth.json')
if os.path.exists(auth_file):
os.remove(auth_file)
Logger.info(f"SettingsPopup: Deleted authentication file: {auth_file}")
self._show_temp_message('✓ Authentication reset - will reauthenticate on restart', (0, 1, 0, 1))
else:
Logger.info("SettingsPopup: No authentication file found")
self._show_temp_message('No authentication file found', (1, 0.7, 0, 1))
except Exception as e:
Logger.error(f"SettingsPopup: Error resetting authentication: {e}")
self._show_temp_message(f'✗ Error: {str(e)}', (1, 0, 0, 1))
def reset_playlist_version(self):
"""Reset playlist version to 0 and rename playlist file"""
try:
playlists_dir = os.path.join(self.player.base_dir, 'playlists')
# Find current playlist file
import glob
playlist_files = glob.glob(os.path.join(playlists_dir, 'server_playlist_v*.json'))
if playlist_files:
# Get the first (should be only one) playlist file
current_playlist = playlist_files[0]
new_playlist = os.path.join(playlists_dir, 'server_playlist_v0.json')
# Rename to v0
os.rename(current_playlist, new_playlist)
Logger.info(f"SettingsPopup: Renamed {os.path.basename(current_playlist)} to server_playlist_v0.json")
# Update player's playlist version
self.player.playlist_version = 0
# Update display
self.ids.playlist_info.text = f'Playlist: v{self.player.playlist_version}'
self._show_temp_message('✓ Playlist reset to v0 - will resync from server', (0, 1, 0, 1))
else:
Logger.info("SettingsPopup: No playlist file found")
self._show_temp_message('No playlist file found', (1, 0.7, 0, 1))
except Exception as e:
Logger.error(f"SettingsPopup: Error resetting playlist: {e}")
self._show_temp_message(f'✗ Error: {str(e)}', (1, 0, 0, 1))
def restart_player(self):
"""Restart playlist from the first item"""
try:
Logger.info("SettingsPopup: Restarting player from first item")
# Reset to first item
self.player.current_index = 0
# Show message
self._show_temp_message('✓ Restarting playlist from beginning...', (0, 1, 0, 1))
# Close settings after a short delay
def close_and_restart(dt):
self.dismiss()
# Start playing from first item
self.player.play_current_media()
Clock.schedule_once(close_and_restart, 2)
except Exception as e:
Logger.error(f"SettingsPopup: Error restarting player: {e}")
self._show_temp_message(f'✗ Error: {str(e)}', (1, 0, 0, 1))
def _show_temp_message(self, message, color):
"""Show a temporary popup message for 2 seconds"""
from kivy.uix.popup import Popup
from kivy.uix.label import Label
popup = Popup(
title='',
content=Label(text=message, color=color),
size_hint=(0.6, 0.3),
auto_dismiss=True
)
popup.open()
# Auto-close after 2 seconds
Clock.schedule_once(lambda dt: popup.dismiss(), 2)
def save_and_close(self):
"""Save configuration and close popup"""
# Update config

View File

@@ -1,10 +1,10 @@
{
"hostname": "rpi-tvholba1",
"auth_code": "73XSgIh2iBu3jaU1VOWSrYSS7c9fCPuZuRd7ygYDcjc",
"hostname": "tv-terasa",
"auth_code": "vkrxEO6eOTxkzXJBtoN4OuXc8eaX2mC3AB9ZePrnick",
"player_id": 1,
"player_name": "Tv-Anunturi Hol Ba1",
"player_name": "TV-acasa",
"playlist_id": 1,
"orientation": "Landscape",
"authenticated": true,
"server_url": "http://digiserver"
"server_url": "http://digi-signage.moto-adv.com"
}

View File

@@ -526,6 +526,42 @@
Widget:
size_hint_y: 0.05
# Reset Buttons Section
Label:
text: 'Reset Options:'
size_hint_y: None
height: dp(30)
text_size: self.size
halign: 'left'
valign: 'middle'
bold: True
font_size: sp(16)
# Reset Buttons Row
BoxLayout:
orientation: 'horizontal'
size_hint_y: None
height: dp(50)
spacing: dp(10)
Button:
id: reset_auth_btn
text: 'Reset Player Auth'
background_color: 0.8, 0.4, 0.2, 1
on_press: root.reset_player_auth()
Button:
id: reset_playlist_btn
text: 'Reset Playlist to v0'
background_color: 0.8, 0.4, 0.2, 1
on_press: root.reset_playlist_version()
Button:
id: restart_player_btn
text: 'Restart Player'
background_color: 0.2, 0.6, 0.8, 1
on_press: root.restart_player()
# Test Connection Button
Button:
id: test_connection_btn
@@ -549,36 +585,39 @@
Widget:
size_hint_y: 0.05
# Status information
Label:
id: playlist_info
text: 'Playlist Version: N/A'
# Status information row
BoxLayout:
orientation: 'horizontal'
size_hint_y: None
height: dp(30)
text_size: self.size
halign: 'left'
valign: 'middle'
spacing: dp(10)
Label:
id: media_count_info
text: 'Media Count: 0'
size_hint_y: None
height: dp(30)
text_size: self.size
halign: 'left'
valign: 'middle'
Label:
id: playlist_info
text: 'Playlist: N/A'
text_size: self.size
halign: 'center'
valign: 'middle'
font_size: sp(12)
Label:
id: status_info
text: 'Status: Idle'
size_hint_y: None
height: dp(30)
text_size: self.size
halign: 'left'
valign: 'middle'
Label:
id: media_count_info
text: 'Media: 0'
text_size: self.size
halign: 'center'
valign: 'middle'
font_size: sp(12)
Label:
id: status_info
text: 'Status: Idle'
text_size: self.size
halign: 'center'
valign: 'middle'
font_size: sp(12)
Widget:
size_hint_y: 0.2
size_hint_y: 0.05
# Action buttons
BoxLayout: