From 34a450d25749303bff8b22389d28357e2fae0b0f Mon Sep 17 00:00:00 2001
From: David Trattnig <david.trattnig@o94.at>
Date: Thu, 29 Oct 2020 19:23:20 +0100
Subject: [PATCH] Replaced schedule term with timeslot. #14

---
 src/models.py                               |  40 ++--
 src/rest/controllers/internal_controller.py |   6 +-
 src/rest/models/__init__.py                 |   2 +-
 src/rest/models/clock_info.py               |  94 +++++---
 src/rest/models/play_log.py                 |  32 +--
 src/rest/models/schedule.py                 | 224 --------------------
 src/rest/models/timeslot.py                 | 224 ++++++++++++++++++++
 src/rest/models/track.py                    |  32 +--
 src/rest/swagger/swagger.yaml               |  67 +++---
 src/rest/test/test_internal_controller.py   |   2 +-
 src/service.py                              |   2 +-
 11 files changed, 377 insertions(+), 348 deletions(-)
 delete mode 100644 src/rest/models/schedule.py
 create mode 100644 src/rest/models/timeslot.py

diff --git a/src/models.py b/src/models.py
index 16215d0..b3023e7 100644
--- a/src/models.py
+++ b/src/models.py
@@ -48,7 +48,7 @@ class PlayLog(db.Model):
     track_type              = Column(Integer)
     track_num               = Column(Integer)
     playlist_id             = Column(Integer)
-    schedule_id             = Column(Integer)
+    timeslot_id             = Column(Integer)
     show_id                 = Column(Integer)
     show_name               = Column(String(256))    
     log_source              = Column(Integer)       # The play-out source which this log is coming from (e.g. engine1, engine2)
@@ -68,7 +68,7 @@ class PlayLog(db.Model):
         self.track_type      = data.track_type
         self.track_num       = data.track_num
         self.playlist_id     = data.playlist_id
-        self.schedule_id     = data.schedule_id
+        self.timeslot_id     = data.timeslot_id
         self.show_id         = data.show_id
         self.show_name       = data.show_name
         self.log_source      = data.log_source      
@@ -129,7 +129,7 @@ class PlayLog(db.Model):
         tracks = db.session.query(PlayLog).\
             order_by(PlayLog.track_start.desc()).\
             filter(PlayLog.track_start >= str(before24h)).\
-            filter(PlayLog.schedule_id == timeslot_id).\
+            filter(PlayLog.timeslot_id == timeslot_id).\
             limit(10)
         
         return tracks.all()
@@ -244,7 +244,7 @@ class TrackSchema(ma.SQLAlchemySchema):
             "track_type",
             "track_num",
             "playlist_id",
-            "schedule_id",
+            "timeslot_id",
             "show_id",
             "show_name"
             )
@@ -374,8 +374,8 @@ class ClockInfo(db.Model):
     log_time             = Column(DateTime)
     current_track        = None                     # Populated live from within `get_info(..)`
     current_playlist     = Column(String(4096))     # Stringified "#/components/schemas/Playlist" OpenAPI JSON object
-    current_schedule     = Column(String(2048))     # Stringified "#/components/schemas/Schedule" OpenAPI JSON object
-    next_schedule        = Column(String(2048))     # Stringified "#/components/schemas/Schedule" OpenAPI JSON object
+    current_timeslot     = Column(String(2048))     # Stringified "#/components/schemas/Schedule" OpenAPI JSON object
+    next_timeslot        = Column(String(2048))     # Stringified "#/components/schemas/Schedule" OpenAPI JSON object
 
 
     def __init__(self):
@@ -384,7 +384,7 @@ class ClockInfo(db.Model):
         """
 
 
-    def set_info(self, source_number, current_playlist, current_schedule, next_schedule):
+    def set_info(self, source_number, current_playlist, current_timeslot, next_timeslot):
         """
         Sets the values for a clock info entry.
         """
@@ -394,14 +394,14 @@ class ClockInfo(db.Model):
             self.current_playlist = json.dumps(current_playlist.to_dict(), default=str)
         else:
             self.current_playlist = None
-        if current_schedule:
-            self.current_schedule = json.dumps(current_schedule.to_dict(), default=str)
+        if current_timeslot:
+            self.current_timeslot = json.dumps(current_timeslot.to_dict(), default=str)
         else:
-            self.current_schedule = None            
-        if next_schedule:
-            self.next_schedule = json.dumps(next_schedule.to_dict(), default=str)
+            self.current_timeslot = None            
+        if next_timeslot:
+            self.next_timeslot = json.dumps(next_timeslot.to_dict(), default=str)
         else:
-            self.next_schedule = None
+            self.next_timeslot = None
 
 
     @staticmethod
@@ -425,7 +425,7 @@ class ClockInfo(db.Model):
         updated_playlist = None
         
         if current_track:
-            updated_playlist = PlayLog.select_for_timeslot(current_track.schedule_id)
+            updated_playlist = PlayLog.select_for_timeslot(current_track.timeslot_id)
             updated_playlist.sort(key=lambda track: track.track_start, reverse=False) 
         
         if data:
@@ -441,10 +441,10 @@ class ClockInfo(db.Model):
                     if next_entry.start_date > datetime.now():                        
                         updated_playlist["entries"].append(next_entry)
                 
-            if data.current_schedule:
-                info["current_schedule"] = json.loads(data.current_schedule)
-            if data.next_schedule:
-                info["next_schedule"] = json.loads(data.next_schedule)
+            if data.current_timeslot:
+                info["current_timeslot"] = json.loads(data.current_timeslot)
+            if data.next_timeslot:
+                info["next_timeslot"] = json.loads(data.next_timeslot)
 
             playlog_schema = PlayLogSchema(many=True)
             info["current_playlist"] = {
@@ -475,6 +475,6 @@ class ClockInfoSchema(ma.SQLAlchemySchema):
             "log_time",
             "current_track",
             "current_playlist",
-            "current_schedule",
-            "next_schedule"
+            "current_timeslot",
+            "next_timeslot"
             )        
\ No newline at end of file
diff --git a/src/rest/controllers/internal_controller.py b/src/rest/controllers/internal_controller.py
index 29ae604..3d43110 100644
--- a/src/rest/controllers/internal_controller.py
+++ b/src/rest/controllers/internal_controller.py
@@ -30,7 +30,7 @@ def add_playlog(body):  # noqa: E501
 def clock_info():  # noqa: E501
     """Get all information to display the studio clock
 
-    Retrieves the currently playing schedule, its playlist and entries plus the next schedule for being used by the studio clock.  # noqa: E501
+    Retrieves the currently playing timeslot, its playlist and entries plus the next timeslot for being used by the studio clock.  # noqa: E501
 
 
     :rtype: ClockInfo
@@ -142,9 +142,9 @@ def set_active_source(number):  # noqa: E501
 
 
 def set_clock_info(body):  # noqa: E501
-    """Set current studio clock information such as schedule info and track-list for engine 1 or 2
+    """Set current studio clock information such as timeslot info and track-list for engine 1 or 2
 
-    Set current studio clock information (source, schedule and track-list) and the next schedule of the given play-out source (engine1, engine2). Please note, the &#x60;current_track&#x60; information is ignored in the PUT request. It&#x27;s only populated in the GET request. To store current track information use &#x60;/playlog/store&#x60; instead.  # noqa: E501
+    Set current studio clock information (source, timeslot and track-list) and the next timeslot of the given play-out source (engine1, engine2). Please note, the &#x60;current_track&#x60; information is ignored in the PUT request. It&#x27;s only populated in the GET request. To store current track information use &#x60;/playlog/store&#x60; instead.  # noqa: E501
 
     :param body: 
     :type body: dict | bytes
diff --git a/src/rest/models/__init__.py b/src/rest/models/__init__.py
index e7deb6d..7330bd7 100644
--- a/src/rest/models/__init__.py
+++ b/src/rest/models/__init__.py
@@ -9,5 +9,5 @@ from src.rest.models.inline_response400 import InlineResponse400
 from src.rest.models.play_log import PlayLog
 from src.rest.models.playlist import Playlist
 from src.rest.models.playlist_entry import PlaylistEntry
-from src.rest.models.schedule import Schedule
+from src.rest.models.timeslot import Timeslot
 from src.rest.models.track import Track
diff --git a/src/rest/models/clock_info.py b/src/rest/models/clock_info.py
index a83a070..d70be28 100644
--- a/src/rest/models/clock_info.py
+++ b/src/rest/models/clock_info.py
@@ -8,7 +8,7 @@ from typing import List, Dict  # noqa: F401
 from src.rest.models.base_model_ import Model
 from src.rest.models.play_log import PlayLog  # noqa: F401,E501
 from src.rest.models.playlist import Playlist  # noqa: F401,E501
-from src.rest.models.schedule import Schedule  # noqa: F401,E501
+from src.rest.models.timeslot import Timeslot  # noqa: F401,E501
 from src.rest import util
 
 
@@ -17,7 +17,7 @@ class ClockInfo(Model):
 
     Do not edit the class manually.
     """
-    def __init__(self, engine_source=None, current_track=None, current_playlist=None, current_schedule=None, next_schedule=None):  # noqa: E501
+    def __init__(self, engine_source=None, current_track=None, current_playlist=None, planned_playlist=None, current_timeslot=None, next_timeslot=None):  # noqa: E501
         """ClockInfo - a model defined in Swagger
 
         :param engine_source: The engine_source of this ClockInfo.  # noqa: E501
@@ -26,31 +26,36 @@ class ClockInfo(Model):
         :type current_track: PlayLog
         :param current_playlist: The current_playlist of this ClockInfo.  # noqa: E501
         :type current_playlist: Playlist
-        :param current_schedule: The current_schedule of this ClockInfo.  # noqa: E501
-        :type current_schedule: Schedule
-        :param next_schedule: The next_schedule of this ClockInfo.  # noqa: E501
-        :type next_schedule: Schedule
+        :param planned_playlist: The planned_playlist of this ClockInfo.  # noqa: E501
+        :type planned_playlist: Playlist
+        :param current_timeslot: The current_timeslot of this ClockInfo.  # noqa: E501
+        :type current_timeslot: Timeslot
+        :param next_timeslot: The next_timeslot of this ClockInfo.  # noqa: E501
+        :type next_timeslot: Timeslot
         """
         self.swagger_types = {
             'engine_source': int,
             'current_track': PlayLog,
             'current_playlist': Playlist,
-            'current_schedule': Schedule,
-            'next_schedule': Schedule
+            'planned_playlist': Playlist,
+            'current_timeslot': Timeslot,
+            'next_timeslot': Timeslot
         }
 
         self.attribute_map = {
             'engine_source': 'engine_source',
             'current_track': 'current_track',
             'current_playlist': 'current_playlist',
-            'current_schedule': 'current_schedule',
-            'next_schedule': 'next_schedule'
+            'planned_playlist': 'planned_playlist',
+            'current_timeslot': 'current_timeslot',
+            'next_timeslot': 'next_timeslot'
         }
         self._engine_source = engine_source
         self._current_track = current_track
         self._current_playlist = current_playlist
-        self._current_schedule = current_schedule
-        self._next_schedule = next_schedule
+        self._planned_playlist = planned_playlist
+        self._current_timeslot = current_timeslot
+        self._next_timeslot = next_timeslot
 
     @classmethod
     def from_dict(cls, dikt):
@@ -127,43 +132,64 @@ class ClockInfo(Model):
         self._current_playlist = current_playlist
 
     @property
-    def current_schedule(self):
-        """Gets the current_schedule of this ClockInfo.
+    def planned_playlist(self):
+        """Gets the planned_playlist of this ClockInfo.
 
 
-        :return: The current_schedule of this ClockInfo.
-        :rtype: Schedule
+        :return: The planned_playlist of this ClockInfo.
+        :rtype: Playlist
+        """
+        return self._planned_playlist
+
+    @planned_playlist.setter
+    def planned_playlist(self, planned_playlist):
+        """Sets the planned_playlist of this ClockInfo.
+
+
+        :param planned_playlist: The planned_playlist of this ClockInfo.
+        :type planned_playlist: Playlist
+        """
+
+        self._planned_playlist = planned_playlist
+
+    @property
+    def current_timeslot(self):
+        """Gets the current_timeslot of this ClockInfo.
+
+
+        :return: The current_timeslot of this ClockInfo.
+        :rtype: Timeslot
         """
-        return self._current_schedule
+        return self._current_timeslot
 
-    @current_schedule.setter
-    def current_schedule(self, current_schedule):
-        """Sets the current_schedule of this ClockInfo.
+    @current_timeslot.setter
+    def current_timeslot(self, current_timeslot):
+        """Sets the current_timeslot of this ClockInfo.
 
 
-        :param current_schedule: The current_schedule of this ClockInfo.
-        :type current_schedule: Schedule
+        :param current_timeslot: The current_timeslot of this ClockInfo.
+        :type current_timeslot: Timeslot
         """
 
-        self._current_schedule = current_schedule
+        self._current_timeslot = current_timeslot
 
     @property
-    def next_schedule(self):
-        """Gets the next_schedule of this ClockInfo.
+    def next_timeslot(self):
+        """Gets the next_timeslot of this ClockInfo.
 
 
-        :return: The next_schedule of this ClockInfo.
-        :rtype: Schedule
+        :return: The next_timeslot of this ClockInfo.
+        :rtype: Timeslot
         """
-        return self._next_schedule
+        return self._next_timeslot
 
-    @next_schedule.setter
-    def next_schedule(self, next_schedule):
-        """Sets the next_schedule of this ClockInfo.
+    @next_timeslot.setter
+    def next_timeslot(self, next_timeslot):
+        """Sets the next_timeslot of this ClockInfo.
 
 
-        :param next_schedule: The next_schedule of this ClockInfo.
-        :type next_schedule: Schedule
+        :param next_timeslot: The next_timeslot of this ClockInfo.
+        :type next_timeslot: Timeslot
         """
 
-        self._next_schedule = next_schedule
+        self._next_timeslot = next_timeslot
diff --git a/src/rest/models/play_log.py b/src/rest/models/play_log.py
index a74cad7..06bccb3 100644
--- a/src/rest/models/play_log.py
+++ b/src/rest/models/play_log.py
@@ -14,7 +14,7 @@ class PlayLog(Model):
 
     Do not edit the class manually.
     """
-    def __init__(self, track_start=None, track_artist=None, track_album=None, track_title=None, track_duration=None, track_type=None, track_num=None, playlist_id=None, schedule_id=None, show_id=None, show_name=None, log_source=None, custom_json=None, is_synced=None):  # noqa: E501
+    def __init__(self, track_start=None, track_artist=None, track_album=None, track_title=None, track_duration=None, track_type=None, track_num=None, playlist_id=None, timeslot_id=None, show_id=None, show_name=None, log_source=None, custom_json=None, is_synced=None):  # noqa: E501
         """PlayLog - a model defined in Swagger
 
         :param track_start: The track_start of this PlayLog.  # noqa: E501
@@ -33,8 +33,8 @@ class PlayLog(Model):
         :type track_num: int
         :param playlist_id: The playlist_id of this PlayLog.  # noqa: E501
         :type playlist_id: int
-        :param schedule_id: The schedule_id of this PlayLog.  # noqa: E501
-        :type schedule_id: int
+        :param timeslot_id: The timeslot_id of this PlayLog.  # noqa: E501
+        :type timeslot_id: int
         :param show_id: The show_id of this PlayLog.  # noqa: E501
         :type show_id: int
         :param show_name: The show_name of this PlayLog.  # noqa: E501
@@ -55,7 +55,7 @@ class PlayLog(Model):
             'track_type': int,
             'track_num': int,
             'playlist_id': int,
-            'schedule_id': int,
+            'timeslot_id': int,
             'show_id': int,
             'show_name': str,
             'log_source': int,
@@ -72,7 +72,7 @@ class PlayLog(Model):
             'track_type': 'track_type',
             'track_num': 'track_num',
             'playlist_id': 'playlist_id',
-            'schedule_id': 'schedule_id',
+            'timeslot_id': 'timeslot_id',
             'show_id': 'show_id',
             'show_name': 'show_name',
             'log_source': 'log_source',
@@ -87,7 +87,7 @@ class PlayLog(Model):
         self._track_type = track_type
         self._track_num = track_num
         self._playlist_id = playlist_id
-        self._schedule_id = schedule_id
+        self._timeslot_id = timeslot_id
         self._show_id = show_id
         self._show_name = show_name
         self._log_source = log_source
@@ -278,25 +278,25 @@ class PlayLog(Model):
         self._playlist_id = playlist_id
 
     @property
-    def schedule_id(self):
-        """Gets the schedule_id of this PlayLog.
+    def timeslot_id(self):
+        """Gets the timeslot_id of this PlayLog.
 
 
-        :return: The schedule_id of this PlayLog.
+        :return: The timeslot_id of this PlayLog.
         :rtype: int
         """
-        return self._schedule_id
+        return self._timeslot_id
 
-    @schedule_id.setter
-    def schedule_id(self, schedule_id):
-        """Sets the schedule_id of this PlayLog.
+    @timeslot_id.setter
+    def timeslot_id(self, timeslot_id):
+        """Sets the timeslot_id of this PlayLog.
 
 
-        :param schedule_id: The schedule_id of this PlayLog.
-        :type schedule_id: int
+        :param timeslot_id: The timeslot_id of this PlayLog.
+        :type timeslot_id: int
         """
 
-        self._schedule_id = schedule_id
+        self._timeslot_id = timeslot_id
 
     @property
     def show_id(self):
diff --git a/src/rest/models/schedule.py b/src/rest/models/schedule.py
deleted file mode 100644
index 25be671..0000000
--- a/src/rest/models/schedule.py
+++ /dev/null
@@ -1,224 +0,0 @@
-# coding: utf-8
-
-from __future__ import absolute_import
-from datetime import date, datetime  # noqa: F401
-
-from typing import List, Dict  # noqa: F401
-
-from src.rest.models.base_model_ import Model
-from src.rest import util
-
-
-class Schedule(Model):
-    """NOTE: This class is auto generated by the swagger code generator program.
-
-    Do not edit the class manually.
-    """
-    def __init__(self, show_name=None, show_id=None, schedule_id=None, schedule_start=None, schedule_end=None, playlist_id=None, fallback_type=None):  # noqa: E501
-        """Schedule - a model defined in Swagger
-
-        :param show_name: The show_name of this Schedule.  # noqa: E501
-        :type show_name: str
-        :param show_id: The show_id of this Schedule.  # noqa: E501
-        :type show_id: int
-        :param schedule_id: The schedule_id of this Schedule.  # noqa: E501
-        :type schedule_id: int
-        :param schedule_start: The schedule_start of this Schedule.  # noqa: E501
-        :type schedule_start: datetime
-        :param schedule_end: The schedule_end of this Schedule.  # noqa: E501
-        :type schedule_end: datetime
-        :param playlist_id: The playlist_id of this Schedule.  # noqa: E501
-        :type playlist_id: int
-        :param fallback_type: The fallback_type of this Schedule.  # noqa: E501
-        :type fallback_type: int
-        """
-        self.swagger_types = {
-            'show_name': str,
-            'show_id': int,
-            'schedule_id': int,
-            'schedule_start': datetime,
-            'schedule_end': datetime,
-            'playlist_id': int,
-            'fallback_type': int
-        }
-
-        self.attribute_map = {
-            'show_name': 'show_name',
-            'show_id': 'show_id',
-            'schedule_id': 'schedule_id',
-            'schedule_start': 'schedule_start',
-            'schedule_end': 'schedule_end',
-            'playlist_id': 'playlist_id',
-            'fallback_type': 'fallback_type'
-        }
-        self._show_name = show_name
-        self._show_id = show_id
-        self._schedule_id = schedule_id
-        self._schedule_start = schedule_start
-        self._schedule_end = schedule_end
-        self._playlist_id = playlist_id
-        self._fallback_type = fallback_type
-
-    @classmethod
-    def from_dict(cls, dikt):
-        """Returns the dict as a model
-
-        :param dikt: A dict.
-        :type: dict
-        :return: The Schedule of this Schedule.  # noqa: E501
-        :rtype: Schedule
-        """
-        return util.deserialize_model(dikt, cls)
-
-    @property
-    def show_name(self):
-        """Gets the show_name of this Schedule.
-
-
-        :return: The show_name of this Schedule.
-        :rtype: str
-        """
-        return self._show_name
-
-    @show_name.setter
-    def show_name(self, show_name):
-        """Sets the show_name of this Schedule.
-
-
-        :param show_name: The show_name of this Schedule.
-        :type show_name: str
-        """
-        if show_name is None:
-            raise ValueError("Invalid value for `show_name`, must not be `None`")  # noqa: E501
-
-        self._show_name = show_name
-
-    @property
-    def show_id(self):
-        """Gets the show_id of this Schedule.
-
-
-        :return: The show_id of this Schedule.
-        :rtype: int
-        """
-        return self._show_id
-
-    @show_id.setter
-    def show_id(self, show_id):
-        """Sets the show_id of this Schedule.
-
-
-        :param show_id: The show_id of this Schedule.
-        :type show_id: int
-        """
-
-        self._show_id = show_id
-
-    @property
-    def schedule_id(self):
-        """Gets the schedule_id of this Schedule.
-
-
-        :return: The schedule_id of this Schedule.
-        :rtype: int
-        """
-        return self._schedule_id
-
-    @schedule_id.setter
-    def schedule_id(self, schedule_id):
-        """Sets the schedule_id of this Schedule.
-
-
-        :param schedule_id: The schedule_id of this Schedule.
-        :type schedule_id: int
-        """
-
-        self._schedule_id = schedule_id
-
-    @property
-    def schedule_start(self):
-        """Gets the schedule_start of this Schedule.
-
-
-        :return: The schedule_start of this Schedule.
-        :rtype: datetime
-        """
-        return self._schedule_start
-
-    @schedule_start.setter
-    def schedule_start(self, schedule_start):
-        """Sets the schedule_start of this Schedule.
-
-
-        :param schedule_start: The schedule_start of this Schedule.
-        :type schedule_start: datetime
-        """
-        if schedule_start is None:
-            raise ValueError("Invalid value for `schedule_start`, must not be `None`")  # noqa: E501
-
-        self._schedule_start = schedule_start
-
-    @property
-    def schedule_end(self):
-        """Gets the schedule_end of this Schedule.
-
-
-        :return: The schedule_end of this Schedule.
-        :rtype: datetime
-        """
-        return self._schedule_end
-
-    @schedule_end.setter
-    def schedule_end(self, schedule_end):
-        """Sets the schedule_end of this Schedule.
-
-
-        :param schedule_end: The schedule_end of this Schedule.
-        :type schedule_end: datetime
-        """
-        if schedule_end is None:
-            raise ValueError("Invalid value for `schedule_end`, must not be `None`")  # noqa: E501
-
-        self._schedule_end = schedule_end
-
-    @property
-    def playlist_id(self):
-        """Gets the playlist_id of this Schedule.
-
-
-        :return: The playlist_id of this Schedule.
-        :rtype: int
-        """
-        return self._playlist_id
-
-    @playlist_id.setter
-    def playlist_id(self, playlist_id):
-        """Sets the playlist_id of this Schedule.
-
-
-        :param playlist_id: The playlist_id of this Schedule.
-        :type playlist_id: int
-        """
-
-        self._playlist_id = playlist_id
-
-    @property
-    def fallback_type(self):
-        """Gets the fallback_type of this Schedule.
-
-
-        :return: The fallback_type of this Schedule.
-        :rtype: int
-        """
-        return self._fallback_type
-
-    @fallback_type.setter
-    def fallback_type(self, fallback_type):
-        """Sets the fallback_type of this Schedule.
-
-
-        :param fallback_type: The fallback_type of this Schedule.
-        :type fallback_type: int
-        """
-
-        self._fallback_type = fallback_type
diff --git a/src/rest/models/timeslot.py b/src/rest/models/timeslot.py
new file mode 100644
index 0000000..d432ddc
--- /dev/null
+++ b/src/rest/models/timeslot.py
@@ -0,0 +1,224 @@
+# coding: utf-8
+
+from __future__ import absolute_import
+from datetime import date, datetime  # noqa: F401
+
+from typing import List, Dict  # noqa: F401
+
+from src.rest.models.base_model_ import Model
+from src.rest import util
+
+
+class Timeslot(Model):
+    """NOTE: This class is auto generated by the swagger code generator program.
+
+    Do not edit the class manually.
+    """
+    def __init__(self, show_name=None, show_id=None, timeslot_id=None, timeslot_start=None, timeslot_end=None, playlist_id=None, fallback_type=None):  # noqa: E501
+        """Timeslot - a model defined in Swagger
+
+        :param show_name: The show_name of this Timeslot.  # noqa: E501
+        :type show_name: str
+        :param show_id: The show_id of this Timeslot.  # noqa: E501
+        :type show_id: int
+        :param timeslot_id: The timeslot_id of this Timeslot.  # noqa: E501
+        :type timeslot_id: int
+        :param timeslot_start: The timeslot_start of this Timeslot.  # noqa: E501
+        :type timeslot_start: datetime
+        :param timeslot_end: The timeslot_end of this Timeslot.  # noqa: E501
+        :type timeslot_end: datetime
+        :param playlist_id: The playlist_id of this Timeslot.  # noqa: E501
+        :type playlist_id: int
+        :param fallback_type: The fallback_type of this Timeslot.  # noqa: E501
+        :type fallback_type: int
+        """
+        self.swagger_types = {
+            'show_name': str,
+            'show_id': int,
+            'timeslot_id': int,
+            'timeslot_start': datetime,
+            'timeslot_end': datetime,
+            'playlist_id': int,
+            'fallback_type': int
+        }
+
+        self.attribute_map = {
+            'show_name': 'show_name',
+            'show_id': 'show_id',
+            'timeslot_id': 'timeslot_id',
+            'timeslot_start': 'timeslot_start',
+            'timeslot_end': 'timeslot_end',
+            'playlist_id': 'playlist_id',
+            'fallback_type': 'fallback_type'
+        }
+        self._show_name = show_name
+        self._show_id = show_id
+        self._timeslot_id = timeslot_id
+        self._timeslot_start = timeslot_start
+        self._timeslot_end = timeslot_end
+        self._playlist_id = playlist_id
+        self._fallback_type = fallback_type
+
+    @classmethod
+    def from_dict(cls, dikt):
+        """Returns the dict as a model
+
+        :param dikt: A dict.
+        :type: dict
+        :return: The Timeslot of this Timeslot.  # noqa: E501
+        :rtype: Timeslot
+        """
+        return util.deserialize_model(dikt, cls)
+
+    @property
+    def show_name(self):
+        """Gets the show_name of this Timeslot.
+
+
+        :return: The show_name of this Timeslot.
+        :rtype: str
+        """
+        return self._show_name
+
+    @show_name.setter
+    def show_name(self, show_name):
+        """Sets the show_name of this Timeslot.
+
+
+        :param show_name: The show_name of this Timeslot.
+        :type show_name: str
+        """
+        if show_name is None:
+            raise ValueError("Invalid value for `show_name`, must not be `None`")  # noqa: E501
+
+        self._show_name = show_name
+
+    @property
+    def show_id(self):
+        """Gets the show_id of this Timeslot.
+
+
+        :return: The show_id of this Timeslot.
+        :rtype: int
+        """
+        return self._show_id
+
+    @show_id.setter
+    def show_id(self, show_id):
+        """Sets the show_id of this Timeslot.
+
+
+        :param show_id: The show_id of this Timeslot.
+        :type show_id: int
+        """
+
+        self._show_id = show_id
+
+    @property
+    def timeslot_id(self):
+        """Gets the timeslot_id of this Timeslot.
+
+
+        :return: The timeslot_id of this Timeslot.
+        :rtype: int
+        """
+        return self._timeslot_id
+
+    @timeslot_id.setter
+    def timeslot_id(self, timeslot_id):
+        """Sets the timeslot_id of this Timeslot.
+
+
+        :param timeslot_id: The timeslot_id of this Timeslot.
+        :type timeslot_id: int
+        """
+
+        self._timeslot_id = timeslot_id
+
+    @property
+    def timeslot_start(self):
+        """Gets the timeslot_start of this Timeslot.
+
+
+        :return: The timeslot_start of this Timeslot.
+        :rtype: datetime
+        """
+        return self._timeslot_start
+
+    @timeslot_start.setter
+    def timeslot_start(self, timeslot_start):
+        """Sets the timeslot_start of this Timeslot.
+
+
+        :param timeslot_start: The timeslot_start of this Timeslot.
+        :type timeslot_start: datetime
+        """
+        if timeslot_start is None:
+            raise ValueError("Invalid value for `timeslot_start`, must not be `None`")  # noqa: E501
+
+        self._timeslot_start = timeslot_start
+
+    @property
+    def timeslot_end(self):
+        """Gets the timeslot_end of this Timeslot.
+
+
+        :return: The timeslot_end of this Timeslot.
+        :rtype: datetime
+        """
+        return self._timeslot_end
+
+    @timeslot_end.setter
+    def timeslot_end(self, timeslot_end):
+        """Sets the timeslot_end of this Timeslot.
+
+
+        :param timeslot_end: The timeslot_end of this Timeslot.
+        :type timeslot_end: datetime
+        """
+        if timeslot_end is None:
+            raise ValueError("Invalid value for `timeslot_end`, must not be `None`")  # noqa: E501
+
+        self._timeslot_end = timeslot_end
+
+    @property
+    def playlist_id(self):
+        """Gets the playlist_id of this Timeslot.
+
+
+        :return: The playlist_id of this Timeslot.
+        :rtype: int
+        """
+        return self._playlist_id
+
+    @playlist_id.setter
+    def playlist_id(self, playlist_id):
+        """Sets the playlist_id of this Timeslot.
+
+
+        :param playlist_id: The playlist_id of this Timeslot.
+        :type playlist_id: int
+        """
+
+        self._playlist_id = playlist_id
+
+    @property
+    def fallback_type(self):
+        """Gets the fallback_type of this Timeslot.
+
+
+        :return: The fallback_type of this Timeslot.
+        :rtype: int
+        """
+        return self._fallback_type
+
+    @fallback_type.setter
+    def fallback_type(self, fallback_type):
+        """Sets the fallback_type of this Timeslot.
+
+
+        :param fallback_type: The fallback_type of this Timeslot.
+        :type fallback_type: int
+        """
+
+        self._fallback_type = fallback_type
diff --git a/src/rest/models/track.py b/src/rest/models/track.py
index 80446c1..5422089 100644
--- a/src/rest/models/track.py
+++ b/src/rest/models/track.py
@@ -14,7 +14,7 @@ class Track(Model):
 
     Do not edit the class manually.
     """
-    def __init__(self, track_start=None, track_artist=None, track_album=None, track_title=None, track_duration=None, track_type=None, track_num=None, playlist_id=None, schedule_id=None, show_id=None, show_name=None):  # noqa: E501
+    def __init__(self, track_start=None, track_artist=None, track_album=None, track_title=None, track_duration=None, track_type=None, track_num=None, playlist_id=None, timeslot_id=None, show_id=None, show_name=None):  # noqa: E501
         """Track - a model defined in Swagger
 
         :param track_start: The track_start of this Track.  # noqa: E501
@@ -33,8 +33,8 @@ class Track(Model):
         :type track_num: int
         :param playlist_id: The playlist_id of this Track.  # noqa: E501
         :type playlist_id: int
-        :param schedule_id: The schedule_id of this Track.  # noqa: E501
-        :type schedule_id: int
+        :param timeslot_id: The timeslot_id of this Track.  # noqa: E501
+        :type timeslot_id: int
         :param show_id: The show_id of this Track.  # noqa: E501
         :type show_id: int
         :param show_name: The show_name of this Track.  # noqa: E501
@@ -49,7 +49,7 @@ class Track(Model):
             'track_type': int,
             'track_num': int,
             'playlist_id': int,
-            'schedule_id': int,
+            'timeslot_id': int,
             'show_id': int,
             'show_name': str
         }
@@ -63,7 +63,7 @@ class Track(Model):
             'track_type': 'track_type',
             'track_num': 'track_num',
             'playlist_id': 'playlist_id',
-            'schedule_id': 'schedule_id',
+            'timeslot_id': 'timeslot_id',
             'show_id': 'show_id',
             'show_name': 'show_name'
         }
@@ -75,7 +75,7 @@ class Track(Model):
         self._track_type = track_type
         self._track_num = track_num
         self._playlist_id = playlist_id
-        self._schedule_id = schedule_id
+        self._timeslot_id = timeslot_id
         self._show_id = show_id
         self._show_name = show_name
 
@@ -263,25 +263,25 @@ class Track(Model):
         self._playlist_id = playlist_id
 
     @property
-    def schedule_id(self):
-        """Gets the schedule_id of this Track.
+    def timeslot_id(self):
+        """Gets the timeslot_id of this Track.
 
 
-        :return: The schedule_id of this Track.
+        :return: The timeslot_id of this Track.
         :rtype: int
         """
-        return self._schedule_id
+        return self._timeslot_id
 
-    @schedule_id.setter
-    def schedule_id(self, schedule_id):
-        """Sets the schedule_id of this Track.
+    @timeslot_id.setter
+    def timeslot_id(self, timeslot_id):
+        """Sets the timeslot_id of this Track.
 
 
-        :param schedule_id: The schedule_id of this Track.
-        :type schedule_id: int
+        :param timeslot_id: The timeslot_id of this Track.
+        :type timeslot_id: int
         """
 
-        self._schedule_id = schedule_id
+        self._timeslot_id = timeslot_id
 
     @property
     def show_id(self):
diff --git a/src/rest/swagger/swagger.yaml b/src/rest/swagger/swagger.yaml
index 21bacfd..26e5fef 100644
--- a/src/rest/swagger/swagger.yaml
+++ b/src/rest/swagger/swagger.yaml
@@ -121,11 +121,11 @@ paths:
       - internal
       summary: Get all information to display the studio clock
       description: |
-        Retrieves the currently playing schedule, its playlist and entries plus the next schedule for being used by the studio clock.
+        Retrieves the currently playing timeslot, its playlist and entries plus the next timeslot for being used by the studio clock.
       operationId: clock_info
       responses:
         "200":
-          description: Show, Schedule and Playlist info for the Studio Clock
+          description: Show, Timeslot and Playlist info for the Studio Clock
           content:
             application/json:
               schema:
@@ -136,10 +136,10 @@ paths:
     put:
       tags:
       - internal
-      summary: Set current studio clock information such as schedule info and track-list
+      summary: Set current studio clock information such as timeslot info and track-list
         for engine 1 or 2 within the Engine API database.
       description: |
-        Set current studio clock information (source, schedule and track-list) and the next schedule of the given play-out source (engine1, engine2). Please note, the `current_track` information is ignored in the PUT request. It's only dynamically populated in the GET request by reading the most recent playlog. To store current track information use `/playlog/store` instead. Also note, similar to the `PlayLog` storage endpoint, this information is only stored to the database if a) it is a main node or b) if it's a sync node, and the `engine_source` is the currently active engine.
+        Set current studio clock information (source, timeslot and track-list) and the next timeslot of the given play-out source (engine1, engine2). Please note, the `current_track` information is ignored in the PUT request. It's only dynamically populated in the GET request by reading the most recent playlog. To store current track information use `/playlog/store` instead. Also note, similar to the `PlayLog` storage endpoint, this information is only stored to the database if a) it is a main node or b) if it's a sync node, and the `engine_source` is the currently active engine.
       operationId: set_clock_info
       requestBody:
         content:
@@ -414,7 +414,7 @@ components:
         playlist_id:
           type: integer
           example: 38
-        schedule_id:
+        timeslot_id:
           type: integer
           example: 23
         show_id:
@@ -434,9 +434,9 @@ components:
         track_num: 11
         show_name: Electronic Music from Brazil
         track_artist: Kyuss
+        timeslot_id: 23
         track_duration: 303
         track_type: 2
-        schedule_id: 23
     PlayLog:
       required:
       - track_start
@@ -469,7 +469,7 @@ components:
         playlist_id:
           type: integer
           example: 38
-        schedule_id:
+        timeslot_id:
           type: integer
           example: 23
         show_id:
@@ -503,6 +503,7 @@ components:
         track_title: Chomp Samba
         show_name: Electronic Music from Brazil
         track_artist: Amon Tobin
+        timeslot_id: 23
         track_type: 2
         is_synced: true
         playlist_id: 38
@@ -510,7 +511,6 @@ components:
         track_num: 11
         log_source: 1
         track_duration: 808
-        schedule_id: 23
         custom_json: '{ "custom": "Stringified JSON Object" }'
     HealthLog:
       required:
@@ -608,10 +608,12 @@ components:
           $ref: '#/components/schemas/PlayLog'
         current_playlist:
           $ref: '#/components/schemas/Playlist'
-        current_schedule:
-          $ref: '#/components/schemas/Schedule'
-        next_schedule:
-          $ref: '#/components/schemas/Schedule'
+        planned_playlist:
+          $ref: '#/components/schemas/Playlist'
+        current_timeslot:
+          $ref: '#/components/schemas/Timeslot'
+        next_timeslot:
+          $ref: '#/components/schemas/Timeslot'
       description: Holds the most recent data required to display the studio clock.
         The field `engine_source` will most likey be the same value as `current_track.log_source`.
         This value represents which engine the record has been logged from. If it
@@ -622,6 +624,14 @@ components:
         while the actual `ClockInfo` was logged from an engine instance instead.
       example:
         engine_source: 1
+        current_timeslot:
+          show_id: 42
+          timeslot_end: 2020-08-29T09:12:33.001Z
+          playlist_id: 38
+          show_name: Electronic Music from Brazil
+          fallback_type: 0
+          timeslot_start: 2020-08-29T09:12:33.001Z
+          timeslot_id: 23
         current_playlist:
           entries:
           - track_album: Bricolage
@@ -645,6 +655,7 @@ components:
           track_title: Chomp Samba
           show_name: Electronic Music from Brazil
           track_artist: Amon Tobin
+          timeslot_id: 23
           track_type: 2
           is_synced: true
           playlist_id: 38
@@ -652,22 +663,14 @@ components:
           track_num: 11
           log_source: 1
           track_duration: 808
-          schedule_id: 23
           custom_json: '{ "custom": "Stringified JSON Object" }'
-        current_schedule:
-          show_id: 42
-          playlist_id: 38
-          show_name: Electronic Music from Brazil
-          fallback_type: 0
-          schedule_end: 2020-08-29T09:12:33.001Z
-          schedule_id: 23
-          schedule_start: 2020-08-29T09:12:33.001Z
-        next_schedule: null
-    Schedule:
+        next_timeslot: null
+        planned_playlist: null
+    Timeslot:
       required:
-      - schedule_end
-      - schedule_start
       - show_name
+      - timeslot_end
+      - timeslot_start
       type: object
       properties:
         show_name:
@@ -676,14 +679,14 @@ components:
         show_id:
           type: integer
           example: 42
-        schedule_id:
+        timeslot_id:
           type: integer
           example: 23
-        schedule_start:
+        timeslot_start:
           type: string
           format: date-time
           example: 2020-08-29T09:12:33.001Z
-        schedule_end:
+        timeslot_end:
           type: string
           format: date-time
           example: 2020-08-29T09:12:33.001Z
@@ -693,16 +696,16 @@ components:
         fallback_type:
           type: integer
           example: 0
-      description: Holds data describing some schedule. Used by `ClockInfo` for the
+      description: Holds data describing some timeslot. Used by `ClockInfo` for the
         studio clock.
       example:
         show_id: 42
+        timeslot_end: 2020-08-29T09:12:33.001Z
         playlist_id: 38
         show_name: Electronic Music from Brazil
         fallback_type: 0
-        schedule_end: 2020-08-29T09:12:33.001Z
-        schedule_id: 23
-        schedule_start: 2020-08-29T09:12:33.001Z
+        timeslot_start: 2020-08-29T09:12:33.001Z
+        timeslot_id: 23
     Playlist:
       required:
       - entries
diff --git a/src/rest/test/test_internal_controller.py b/src/rest/test/test_internal_controller.py
index 1cba877..4f34752 100644
--- a/src/rest/test/test_internal_controller.py
+++ b/src/rest/test/test_internal_controller.py
@@ -136,7 +136,7 @@ class TestInternalController(BaseTestCase):
     def test_set_clock_info(self):
         """Test case for set_clock_info
 
-        Set current studio clock information such as schedule info and track-list for engine 1 or 2 within the Engine API database.
+        Set current studio clock information such as timeslot info and track-list for engine 1 or 2 within the Engine API database.
         """
         body = ClockInfo()
         response = self.client.open(
diff --git a/src/service.py b/src/service.py
index 87fa8ff..a6163dd 100644
--- a/src/service.py
+++ b/src/service.py
@@ -210,7 +210,7 @@ class ApiService():
         else:
             clock_info = ClockInfo()
 
-        clock_info.set_info(data.engine_source, data.current_playlist, data.current_schedule, data.next_schedule)
+        clock_info.set_info(data.engine_source, data.current_playlist, data.current_timeslot, data.next_timeslot)
         
         if is_existing:
             clock_info.update()
-- 
GitLab