Compare commits
2 Commits
706af95557
...
46d9fcf6e3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
46d9fcf6e3 | ||
|
|
f1a84d05d5 |
1
.player_stop_requested
Normal file
1
.player_stop_requested
Normal file
@@ -0,0 +1 @@
|
|||||||
|
User requested exit via password
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"server_ip": "digiserver",
|
"server_ip": "digi-signage.moto-adv.com",
|
||||||
"port": "80",
|
"port": "443",
|
||||||
"screen_name": "rpi-tvholba1",
|
"screen_name": "tv-terasa",
|
||||||
"quickconnect_key": "8887779",
|
"quickconnect_key": "8887779",
|
||||||
"orientation": "Landscape",
|
"orientation": "Landscape",
|
||||||
"touch": "True",
|
"touch": "True",
|
||||||
|
|||||||
91
src/main.py
91
src/main.py
@@ -1126,8 +1126,8 @@ class SettingsPopup(Popup):
|
|||||||
self.ids.edit_enabled_checkbox.active = self.player.config.get('edit_feature_enabled', True)
|
self.ids.edit_enabled_checkbox.active = self.player.config.get('edit_feature_enabled', True)
|
||||||
|
|
||||||
# Update status info
|
# Update status info
|
||||||
self.ids.playlist_info.text = f'Playlist Version: {self.player.playlist_version}'
|
self.ids.playlist_info.text = f'Playlist: v{self.player.playlist_version}'
|
||||||
self.ids.media_count_info.text = f'Media Count: {len(self.player.playlist)}'
|
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"}'
|
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
|
# Bind to dismiss event to manage cursor visibility and resume playback
|
||||||
@@ -1267,6 +1267,93 @@ class SettingsPopup(Popup):
|
|||||||
else:
|
else:
|
||||||
self.ids.connection_status.color = (1, 0, 0, 1) # Red
|
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):
|
def save_and_close(self):
|
||||||
"""Save configuration and close popup"""
|
"""Save configuration and close popup"""
|
||||||
# Update config
|
# Update config
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
{
|
{
|
||||||
"hostname": "rpi-tvholba1",
|
"hostname": "tv-terasa",
|
||||||
"auth_code": "73XSgIh2iBu3jaU1VOWSrYSS7c9fCPuZuRd7ygYDcjc",
|
"auth_code": "vkrxEO6eOTxkzXJBtoN4OuXc8eaX2mC3AB9ZePrnick",
|
||||||
"player_id": 1,
|
"player_id": 1,
|
||||||
"player_name": "Tv-Anunturi Hol Ba1",
|
"player_name": "TV-acasa",
|
||||||
"playlist_id": 1,
|
"playlist_id": 1,
|
||||||
"orientation": "Landscape",
|
"orientation": "Landscape",
|
||||||
"authenticated": true,
|
"authenticated": true,
|
||||||
"server_url": "http://digiserver"
|
"server_url": "http://digi-signage.moto-adv.com"
|
||||||
}
|
}
|
||||||
@@ -526,6 +526,42 @@
|
|||||||
Widget:
|
Widget:
|
||||||
size_hint_y: 0.05
|
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
|
# Test Connection Button
|
||||||
Button:
|
Button:
|
||||||
id: test_connection_btn
|
id: test_connection_btn
|
||||||
@@ -549,36 +585,39 @@
|
|||||||
Widget:
|
Widget:
|
||||||
size_hint_y: 0.05
|
size_hint_y: 0.05
|
||||||
|
|
||||||
# Status information
|
# Status information row
|
||||||
Label:
|
BoxLayout:
|
||||||
id: playlist_info
|
orientation: 'horizontal'
|
||||||
text: 'Playlist Version: N/A'
|
|
||||||
size_hint_y: None
|
size_hint_y: None
|
||||||
height: dp(30)
|
height: dp(30)
|
||||||
text_size: self.size
|
spacing: dp(10)
|
||||||
halign: 'left'
|
|
||||||
valign: 'middle'
|
|
||||||
|
|
||||||
Label:
|
Label:
|
||||||
id: media_count_info
|
id: playlist_info
|
||||||
text: 'Media Count: 0'
|
text: 'Playlist: N/A'
|
||||||
size_hint_y: None
|
text_size: self.size
|
||||||
height: dp(30)
|
halign: 'center'
|
||||||
text_size: self.size
|
valign: 'middle'
|
||||||
halign: 'left'
|
font_size: sp(12)
|
||||||
valign: 'middle'
|
|
||||||
|
|
||||||
Label:
|
Label:
|
||||||
id: status_info
|
id: media_count_info
|
||||||
text: 'Status: Idle'
|
text: 'Media: 0'
|
||||||
size_hint_y: None
|
text_size: self.size
|
||||||
height: dp(30)
|
halign: 'center'
|
||||||
text_size: self.size
|
valign: 'middle'
|
||||||
halign: 'left'
|
font_size: sp(12)
|
||||||
valign: 'middle'
|
|
||||||
|
Label:
|
||||||
|
id: status_info
|
||||||
|
text: 'Status: Idle'
|
||||||
|
text_size: self.size
|
||||||
|
halign: 'center'
|
||||||
|
valign: 'middle'
|
||||||
|
font_size: sp(12)
|
||||||
|
|
||||||
Widget:
|
Widget:
|
||||||
size_hint_y: 0.2
|
size_hint_y: 0.05
|
||||||
|
|
||||||
# Action buttons
|
# Action buttons
|
||||||
BoxLayout:
|
BoxLayout:
|
||||||
|
|||||||
Reference in New Issue
Block a user