Fix video not advancing + media not downloading on same-version startup

BUG-009: _on_video_eos was empty (stub). Added Clock.schedule_once
for next_media() when video reaches end of stream.

BUG-008: download_media_files only ran when server_version >
local_version. Added download check in up-to-date branch so media
files are synced even when playlist version hasn't changed.
This commit is contained in:
ske087
2026-07-24 15:43:56 +03:00
parent c4e8381898
commit a2add88f04
3 changed files with 29 additions and 4 deletions
+12
View File
@@ -454,6 +454,18 @@ def update_playlist_if_needed(config, playlist_dir, media_dir):
return playlist_file
else:
logger.info("✓ Playlist is up to date")
# Even when the playlist version matches, ensure media files exist locally.
# The media folder might be empty (e.g. fresh install or deleted files).
logger.info("📥 Checking for missing media files...")
ssl_manager = auth.ssl_manager if config.get('use_https', True) else None
server_url = auth.auth_data.get('server_url', '')
downloaded = download_media_files(
server_data.get('playlist', []), media_dir, ssl_manager, server_url
)
if downloaded:
server_data['playlist'] = downloaded
# Re-save playlist with updated URLs if needed
save_playlist(server_data, playlist_dir)
return playlist_file
except Exception as e:
+3
View File
@@ -1522,6 +1522,9 @@ class SignagePlayer(Widget):
def _on_video_eos(self, instance):
"""Callback when video reaches end of stream"""
Logger.debug("SignagePlayer: Video finished playing (EOS)")
# Unschedule any pending timer and advance to next media
Clock.unschedule(self.next_media)
Clock.schedule_once(self.next_media, 0.5)
def _on_video_loaded(self, instance, value):
"""Callback when video is loaded - log video information"""