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
This commit is contained in:
ske087
2026-07-24 09:53:29 +03:00
parent 3845830a86
commit 362f5096a0
2 changed files with 302 additions and 281 deletions
+9 -1
View File
@@ -1299,7 +1299,11 @@ class SignagePlayer(Widget):
Logger.debug(f"SignagePlayer: Skipping play_current_media - player is paused") Logger.debug(f"SignagePlayer: Skipping play_current_media - player is paused")
return return
if not self.playlist or self.current_index >= len(self.playlist): if not self.playlist:
Logger.warning("SignagePlayer: Cannot play - playlist is empty")
return
if self.current_index >= len(self.playlist):
# End of playlist, restart # End of playlist, restart
self.restart_playlist() self.restart_playlist()
return return
@@ -2068,6 +2072,10 @@ class SignagePlayer(Widget):
def restart_playlist(self): def restart_playlist(self):
"""Restart playlist from beginning""" """Restart playlist from beginning"""
if not self.playlist:
Logger.warning("SignagePlayer: Cannot restart - playlist is empty")
return
Logger.info("SignagePlayer: Restarting playlist") Logger.info("SignagePlayer: Restarting playlist")
# Send restart feedback asynchronously (non-blocking) # Send restart feedback asynchronously (non-blocking)
+62 -49
View File
@@ -352,20 +352,27 @@
# Settings popup content # Settings popup content
<SettingsPopup@Popup>: <SettingsPopup@Popup>:
title: 'Player Settings' title: 'Player Settings'
size_hint: 0.8, 0.8 size_hint: 0.9, 0.85
auto_dismiss: True auto_dismiss: True
BoxLayout: BoxLayout:
orientation: 'vertical' orientation: 'vertical'
padding: dp(20) padding: [dp(15), dp(10)]
spacing: dp(15) spacing: dp(8)
ScrollView:
BoxLayout:
orientation: 'vertical'
spacing: dp(8)
size_hint_y: None
height: self.minimum_height
# Server configuration # Server configuration
BoxLayout: BoxLayout:
orientation: 'horizontal' orientation: 'horizontal'
size_hint_y: None size_hint_y: None
height: dp(40) height: dp(36)
spacing: dp(10) spacing: dp(8)
Label: Label:
text: 'Server IP:' text: 'Server IP:'
@@ -378,7 +385,7 @@
id: server_input id: server_input
size_hint_x: 0.7 size_hint_x: 0.7
multiline: False multiline: False
font_size: sp(14) font_size: sp(13)
write_tab: False write_tab: False
on_touch_down: root.on_input_touch(self, args[1]) if self.collide_point(*args[1].pos) else None on_touch_down: root.on_input_touch(self, args[1]) if self.collide_point(*args[1].pos) else None
@@ -386,8 +393,8 @@
BoxLayout: BoxLayout:
orientation: 'horizontal' orientation: 'horizontal'
size_hint_y: None size_hint_y: None
height: dp(40) height: dp(36)
spacing: dp(10) spacing: dp(8)
Label: Label:
text: 'Port:' text: 'Port:'
@@ -400,7 +407,7 @@
id: port_input id: port_input
size_hint_x: 0.7 size_hint_x: 0.7
multiline: False multiline: False
font_size: sp(14) font_size: sp(13)
hint_text: '80 or 8080 (leave empty for default)' hint_text: '80 or 8080 (leave empty for default)'
input_filter: 'int' input_filter: 'int'
write_tab: False write_tab: False
@@ -410,8 +417,8 @@
BoxLayout: BoxLayout:
orientation: 'horizontal' orientation: 'horizontal'
size_hint_y: None size_hint_y: None
height: dp(40) height: dp(36)
spacing: dp(10) spacing: dp(8)
Label: Label:
text: 'Screen Name:' text: 'Screen Name:'
@@ -424,7 +431,7 @@
id: screen_input id: screen_input
size_hint_x: 0.7 size_hint_x: 0.7
multiline: False multiline: False
font_size: sp(14) font_size: sp(13)
write_tab: False write_tab: False
on_touch_down: root.on_input_touch(self, args[1]) if self.collide_point(*args[1].pos) else None on_touch_down: root.on_input_touch(self, args[1]) if self.collide_point(*args[1].pos) else None
@@ -432,8 +439,8 @@
BoxLayout: BoxLayout:
orientation: 'horizontal' orientation: 'horizontal'
size_hint_y: None size_hint_y: None
height: dp(40) height: dp(36)
spacing: dp(10) spacing: dp(8)
Label: Label:
text: 'Quickconnect:' text: 'Quickconnect:'
@@ -446,7 +453,7 @@
id: quickconnect_input id: quickconnect_input
size_hint_x: 0.7 size_hint_x: 0.7
multiline: False multiline: False
font_size: sp(14) font_size: sp(13)
write_tab: False write_tab: False
on_touch_down: root.on_input_touch(self, args[1]) if self.collide_point(*args[1].pos) else None on_touch_down: root.on_input_touch(self, args[1]) if self.collide_point(*args[1].pos) else None
@@ -454,8 +461,8 @@
BoxLayout: BoxLayout:
orientation: 'horizontal' orientation: 'horizontal'
size_hint_y: None size_hint_y: None
height: dp(40) height: dp(36)
spacing: dp(10) spacing: dp(8)
Label: Label:
text: 'Orientation:' text: 'Orientation:'
@@ -468,7 +475,7 @@
id: orientation_input id: orientation_input
size_hint_x: 0.7 size_hint_x: 0.7
multiline: False multiline: False
font_size: sp(14) font_size: sp(13)
write_tab: False write_tab: False
on_touch_down: root.on_input_touch(self, args[1]) if self.collide_point(*args[1].pos) else None on_touch_down: root.on_input_touch(self, args[1]) if self.collide_point(*args[1].pos) else None
@@ -476,8 +483,8 @@
BoxLayout: BoxLayout:
orientation: 'horizontal' orientation: 'horizontal'
size_hint_y: None size_hint_y: None
height: dp(40) height: dp(36)
spacing: dp(10) spacing: dp(8)
Label: Label:
text: 'Touch:' text: 'Touch:'
@@ -490,7 +497,7 @@
id: touch_input id: touch_input
size_hint_x: 0.7 size_hint_x: 0.7
multiline: False multiline: False
font_size: sp(14) font_size: sp(13)
write_tab: False write_tab: False
on_touch_down: root.on_input_touch(self, args[1]) if self.collide_point(*args[1].pos) else None on_touch_down: root.on_input_touch(self, args[1]) if self.collide_point(*args[1].pos) else None
@@ -498,8 +505,8 @@
BoxLayout: BoxLayout:
orientation: 'horizontal' orientation: 'horizontal'
size_hint_y: None size_hint_y: None
height: dp(40) height: dp(36)
spacing: dp(10) spacing: dp(8)
Label: Label:
text: 'Max Resolution:' text: 'Max Resolution:'
@@ -512,7 +519,7 @@
id: resolution_input id: resolution_input
size_hint_x: 0.7 size_hint_x: 0.7
multiline: False multiline: False
font_size: sp(14) font_size: sp(13)
hint_text: '1920x1080 or auto' hint_text: '1920x1080 or auto'
write_tab: False write_tab: False
on_touch_down: root.on_input_touch(self, args[1]) if self.collide_point(*args[1].pos) else None on_touch_down: root.on_input_touch(self, args[1]) if self.collide_point(*args[1].pos) else None
@@ -521,11 +528,11 @@
BoxLayout: BoxLayout:
orientation: 'horizontal' orientation: 'horizontal'
size_hint_y: None size_hint_y: None
height: dp(40) height: dp(36)
spacing: dp(10) spacing: dp(8)
Label: Label:
text: 'Enable Edit Feature:' text: 'Enable Edit:'
size_hint_x: 0.3 size_hint_x: 0.3
text_size: self.size text_size: self.size
halign: 'left' halign: 'left'
@@ -534,56 +541,61 @@
CheckBox: CheckBox:
id: edit_enabled_checkbox id: edit_enabled_checkbox
size_hint_x: None size_hint_x: None
width: dp(40) width: dp(36)
active: True active: True
on_active: root.on_edit_feature_toggle(self.active) on_active: root.on_edit_feature_toggle(self.active)
Label: Label:
text: '(Allow editing images on this player)' text: '(Allow editing images)'
size_hint_x: 0.4 size_hint_x: 0.4
font_size: sp(12) font_size: sp(11)
text_size: self.size text_size: self.size
halign: 'left' halign: 'left'
valign: 'middle' valign: 'middle'
color: 0.7, 0.7, 0.7, 1 color: 0.7, 0.7, 0.7, 1
# Separator
Widget: Widget:
size_hint_y: 0.05 size_hint_y: None
height: dp(5)
# Reset Buttons Section # Reset Buttons Section
Label: Label:
text: 'Reset Options:' text: 'Reset Options:'
size_hint_y: None size_hint_y: None
height: dp(30) height: dp(26)
text_size: self.size text_size: self.size
halign: 'left' halign: 'left'
valign: 'middle' valign: 'middle'
bold: True bold: True
font_size: sp(16) font_size: sp(14)
# Reset Buttons Row # Reset Buttons Row
BoxLayout: BoxLayout:
orientation: 'horizontal' orientation: 'horizontal'
size_hint_y: None size_hint_y: None
height: dp(50) height: dp(44)
spacing: dp(10) spacing: dp(8)
Button: Button:
id: reset_auth_btn id: reset_auth_btn
text: 'Reset Player Auth' text: 'Reset Player Auth'
background_color: 0.8, 0.4, 0.2, 1 background_color: 0.8, 0.4, 0.2, 1
font_size: sp(12)
on_press: root.reset_player_auth() on_press: root.reset_player_auth()
Button: Button:
id: reset_playlist_btn id: reset_playlist_btn
text: 'Reset Playlist to v0' text: 'Reset Playlist to v0'
background_color: 0.8, 0.4, 0.2, 1 background_color: 0.8, 0.4, 0.2, 1
font_size: sp(12)
on_press: root.reset_playlist_version() on_press: root.reset_playlist_version()
Button: Button:
id: restart_player_btn id: restart_player_btn
text: 'Restart Player' text: 'Restart Player'
background_color: 0.2, 0.6, 0.8, 1 background_color: 0.2, 0.6, 0.8, 1
font_size: sp(12)
on_press: root.restart_player() on_press: root.restart_player()
# Test Connection Button # Test Connection Button
@@ -591,8 +603,9 @@
id: test_connection_btn id: test_connection_btn
text: 'Test Server Connection' text: 'Test Server Connection'
size_hint_y: None size_hint_y: None
height: dp(50) height: dp(44)
background_color: 0.2, 0.4, 0.8, 1 background_color: 0.2, 0.4, 0.8, 1
font_size: sp(13)
on_press: root.test_connection() on_press: root.test_connection()
# Connection Status Label # Connection Status Label
@@ -600,21 +613,24 @@
id: connection_status id: connection_status
text: 'Click button to test connection' text: 'Click button to test connection'
size_hint_y: None size_hint_y: None
height: dp(40) height: dp(32)
text_size: self.size text_size: self.size
halign: 'center' halign: 'center'
valign: 'middle' valign: 'middle'
font_size: sp(11)
color: 0.7, 0.7, 0.7, 1 color: 0.7, 0.7, 0.7, 1
# Separator
Widget: Widget:
size_hint_y: 0.05 size_hint_y: None
height: dp(5)
# Status information row # Status information row
BoxLayout: BoxLayout:
orientation: 'horizontal' orientation: 'horizontal'
size_hint_y: None size_hint_y: None
height: dp(30) height: dp(26)
spacing: dp(10) spacing: dp(8)
Label: Label:
id: playlist_info id: playlist_info
@@ -622,7 +638,7 @@
text_size: self.size text_size: self.size
halign: 'center' halign: 'center'
valign: 'middle' valign: 'middle'
font_size: sp(12) font_size: sp(11)
Label: Label:
id: media_count_info id: media_count_info
@@ -630,7 +646,7 @@
text_size: self.size text_size: self.size
halign: 'center' halign: 'center'
valign: 'middle' valign: 'middle'
font_size: sp(12) font_size: sp(11)
Label: Label:
id: status_info id: status_info
@@ -638,17 +654,14 @@
text_size: self.size text_size: self.size
halign: 'center' halign: 'center'
valign: 'middle' valign: 'middle'
font_size: sp(12) font_size: sp(11)
Widget: # Action buttons (always visible, outside scroll)
size_hint_y: 0.05
# Action buttons
BoxLayout: BoxLayout:
orientation: 'horizontal' orientation: 'horizontal'
size_hint_y: None size_hint_y: None
height: dp(50) height: dp(44)
spacing: dp(20) spacing: dp(15)
Button: Button:
text: 'Save & Close' text: 'Save & Close'