From 155d8b56a2412fe2d8aa26ef1fea25699f7ab3f6 Mon Sep 17 00:00:00 2001
From: David Trattnig <david.trattnig@o94.at>
Date: Wed, 19 Feb 2020 14:49:50 +0100
Subject: [PATCH] Initialize playlist, instead of single track.

---
 modules/communication/liquidsoap/initthread.py | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/modules/communication/liquidsoap/initthread.py b/modules/communication/liquidsoap/initthread.py
index 20b49196..4e92586c 100644
--- a/modules/communication/liquidsoap/initthread.py
+++ b/modules/communication/liquidsoap/initthread.py
@@ -89,17 +89,21 @@ class LiquidSoapInitThread(threading.Thread):
             
             if channel == ScheduleEntryType.FILESYSTEM:
 
-                # Have to seek? Calc how many seconds were missed
-                now_unix = time.mktime(datetime.datetime.now().timetuple())
-                seconds_to_seek = now_unix - self.active_entry.start_unix
-
                 # TODO For some reason LiquidSoap cue-points don't work. Actually,
                 # this would be the ideal approach to seek. Investigate some solution!
                 # if seconds_to_seek < 0:
                 #     seconds_to_seek = 0
                 # self.liquidsoapcommunicator.activate(self.active_entry, seconds_to_seek)
+                
+                self.liquidsoapcommunicator.activate(self.active_entry)
+                rest_of_playlist = self.active_entry.get_next_entries()
+                for entry in rest_of_playlist:
+                    self.logger.info("ACTIVATING NEXT ENTRY: %s" %entry)
+                    self.liquidsoapcommunicator.activate(entry)
 
-                self.liquidsoapcommunicator.activate(self.active_entry, seconds_to_seek)
+                # Have to seek? Calc how many seconds were missed
+                now_unix = time.mktime(datetime.datetime.now().timetuple())
+                seconds_to_seek = now_unix - self.active_entry.start_unix
 
                 # And seek these seconds forward
                 if seconds_to_seek > 0:
-- 
GitLab