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