From e2e3dbfbe0fec726f30fdeffed89fb7b79cdb792 Mon Sep 17 00:00:00 2001 From: glenneth Date: Wed, 17 Dec 2025 15:31:37 +0300 Subject: [PATCH] fix: Load current scheduled playlist on startup The scheduler now loads the appropriate playlist immediately when the server starts, not just at the next scheduled time. This ensures the stream plays the correct time-based playlist right away. --- playlist-scheduler.lisp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/playlist-scheduler.lisp b/playlist-scheduler.lisp index 6066221..b5e8685 100644 --- a/playlist-scheduler.lisp +++ b/playlist-scheduler.lisp @@ -246,12 +246,17 @@ ;;; Auto-start scheduler when database is connected ;;; This ensures the scheduler starts after the server is fully initialized -(define-trigger db:connected :after () +(define-trigger db:connected () "Start the playlist scheduler after database connection is established" (format t "~&[SCHEDULER] Database connected, starting playlist scheduler...~%") (handler-case (progn (start-playlist-scheduler) + ;; Load the current scheduled playlist on startup + (let ((current-playlist (get-current-scheduled-playlist))) + (when current-playlist + (format t "~&[SCHEDULER] Loading current scheduled playlist: ~a~%" current-playlist) + (load-scheduled-playlist current-playlist))) (format t "~&[SCHEDULER] Scheduler auto-started successfully~%")) (error (e) (format t "~&[SCHEDULER] Warning: Could not auto-start scheduler: ~a~%" e))))