diff --git a/src/rest/controllers/internal_controller.py b/src/rest/controllers/internal_controller.py index 85dee7f5b019b68bea66e5d208a8c5700c4c42f5..6e3fd8f485a302df2b17e75439ab1ea854925ecd 100644 --- a/src/rest/controllers/internal_controller.py +++ b/src/rest/controllers/internal_controller.py @@ -82,8 +82,10 @@ def list_playlog(from_date=None, to_date=None, page=None, limit=None, skip_synce Get paginated playlog entries for since the given timestamp. # noqa: E501 - :param date_time: Get entries after this timestamp (e.g. '2020-08-29T09:12:33.001Z') - :type date_time: str + :param from_date: Get entries after this timestamp + :type from_date: str + :param to_date: Get entries before this timestamp + :type to_date: str :param page: The number of items to skip before starting to collect the result set :type page: int :param limit: The numbers of items to return per page @@ -111,6 +113,8 @@ def log_source_health(body, number): # noqa: E501 Logs another health entry for the given engine # noqa: E501 + :param body: + :type body: dict | bytes :param number: Number of the engine :type number: int @@ -134,3 +138,16 @@ def set_active_source(number): # noqa: E501 """ service = current_app.config['SERVICE'] return service.set_active_source(number) + + +def set_clock_info(number): # noqa: E501 + """Set current studio clock information such as schedule info and track-list for engine 1 or 2 + + Set current studio clock information (schedule and track-list) of the given play-out source (engine1, engine2) # noqa: E501 + + :param number: Number of the engine + :type number: int + + :rtype: None + """ + return 'do some magic!' diff --git a/src/rest/controllers/public_controller.py b/src/rest/controllers/public_controller.py index 43328ca0aa4cf9cac2eac9d57237c25e94daca9f..8a75fd52bc6e348959e6f288989e7cb653361524 100644 --- a/src/rest/controllers/public_controller.py +++ b/src/rest/controllers/public_controller.py @@ -2,8 +2,7 @@ import connexion import six from flask import current_app - -from src.rest.models.play_log import PlayLog # noqa: E501 +from src.rest.models.track import Track # noqa: E501 from src.rest import util diff --git a/src/rest/models/__init__.py b/src/rest/models/__init__.py index 00e5db4dcb8e5ddcfddd61b3fa47f844d967c2e3..e7deb6db625b1a1f22f22187f01de84925927cc0 100644 --- a/src/rest/models/__init__.py +++ b/src/rest/models/__init__.py @@ -7,5 +7,7 @@ from src.rest.models.clock_info import ClockInfo from src.rest.models.health_log import HealthLog from src.rest.models.inline_response400 import InlineResponse400 from src.rest.models.play_log import PlayLog -from src.rest.models.timeslot import Timeslot +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.track import Track diff --git a/src/rest/models/clock_info.py b/src/rest/models/clock_info.py index 93a544db4c7ea0685ddc72fca306ec1687ae8ec9..a83a0702b16153b97d7479a1c2ac5a67315e1730 100644 --- a/src/rest/models/clock_info.py +++ b/src/rest/models/clock_info.py @@ -7,7 +7,8 @@ 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.timeslot import Timeslot # 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 import util @@ -16,30 +17,40 @@ class ClockInfo(Model): Do not edit the class manually. """ - def __init__(self, current_track=None, current_timeslot=None, next_timeslot=None): # noqa: E501 + def __init__(self, engine_source=None, current_track=None, current_playlist=None, current_schedule=None, next_schedule=None): # noqa: E501 """ClockInfo - a model defined in Swagger + :param engine_source: The engine_source of this ClockInfo. # noqa: E501 + :type engine_source: int :param current_track: The current_track of this ClockInfo. # noqa: E501 :type current_track: PlayLog - :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 + :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 """ self.swagger_types = { + 'engine_source': int, 'current_track': PlayLog, - 'current_timeslot': Timeslot, - 'next_timeslot': Timeslot + 'current_playlist': Playlist, + 'current_schedule': Schedule, + 'next_schedule': Schedule } self.attribute_map = { + 'engine_source': 'engine_source', 'current_track': 'current_track', - 'current_timeslot': 'current_timeslot', - 'next_timeslot': 'next_timeslot' + 'current_playlist': 'current_playlist', + 'current_schedule': 'current_schedule', + 'next_schedule': 'next_schedule' } + self._engine_source = engine_source self._current_track = current_track - self._current_timeslot = current_timeslot - self._next_timeslot = next_timeslot + self._current_playlist = current_playlist + self._current_schedule = current_schedule + self._next_schedule = next_schedule @classmethod def from_dict(cls, dikt): @@ -52,6 +63,27 @@ class ClockInfo(Model): """ return util.deserialize_model(dikt, cls) + @property + def engine_source(self): + """Gets the engine_source of this ClockInfo. + + + :return: The engine_source of this ClockInfo. + :rtype: int + """ + return self._engine_source + + @engine_source.setter + def engine_source(self, engine_source): + """Sets the engine_source of this ClockInfo. + + + :param engine_source: The engine_source of this ClockInfo. + :type engine_source: int + """ + + self._engine_source = engine_source + @property def current_track(self): """Gets the current_track of this ClockInfo. @@ -74,45 +106,64 @@ class ClockInfo(Model): self._current_track = current_track @property - def current_timeslot(self): - """Gets the current_timeslot of this ClockInfo. + def current_playlist(self): + """Gets the current_playlist of this ClockInfo. + + + :return: The current_playlist of this ClockInfo. + :rtype: Playlist + """ + return self._current_playlist + + @current_playlist.setter + def current_playlist(self, current_playlist): + """Sets the current_playlist of this ClockInfo. + + + :param current_playlist: The current_playlist of this ClockInfo. + :type current_playlist: Playlist + """ + + self._current_playlist = current_playlist + + @property + def current_schedule(self): + """Gets the current_schedule of this ClockInfo. - :return: The current_timeslot of this ClockInfo. - :rtype: Timeslot + :return: The current_schedule of this ClockInfo. + :rtype: Schedule """ - return self._current_timeslot + return self._current_schedule - @current_timeslot.setter - def current_timeslot(self, current_timeslot): - """Sets the current_timeslot of this ClockInfo. + @current_schedule.setter + def current_schedule(self, current_schedule): + """Sets the current_schedule of this ClockInfo. - :param current_timeslot: The current_timeslot of this ClockInfo. - :type current_timeslot: Timeslot + :param current_schedule: The current_schedule of this ClockInfo. + :type current_schedule: Schedule """ - if current_timeslot is None: - raise ValueError("Invalid value for `current_timeslot`, must not be `None`") # noqa: E501 - self._current_timeslot = current_timeslot + self._current_schedule = current_schedule @property - def next_timeslot(self): - """Gets the next_timeslot of this ClockInfo. + def next_schedule(self): + """Gets the next_schedule of this ClockInfo. - :return: The next_timeslot of this ClockInfo. - :rtype: Timeslot + :return: The next_schedule of this ClockInfo. + :rtype: Schedule """ - return self._next_timeslot + return self._next_schedule - @next_timeslot.setter - def next_timeslot(self, next_timeslot): - """Sets the next_timeslot of this ClockInfo. + @next_schedule.setter + def next_schedule(self, next_schedule): + """Sets the next_schedule of this ClockInfo. - :param next_timeslot: The next_timeslot of this ClockInfo. - :type next_timeslot: Timeslot + :param next_schedule: The next_schedule of this ClockInfo. + :type next_schedule: Schedule """ - self._next_timeslot = next_timeslot + self._next_schedule = next_schedule diff --git a/src/rest/models/play_log.py b/src/rest/models/play_log.py index 97338fc882bd45f697c1337b4a985e899e9bab5d..e472a5a5fd1b499783304700254b63c603f347a5 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, timeslot_id=None, show_name=None, log_source=None): # noqa: E501 + def __init__(self, track_start=None, track_artist=None, track_album=None, track_title=None, track_duration=None, track_type=None, schedule_id=None, show_id=None, show_name=None, log_source=None): # noqa: E501 """PlayLog - a model defined in Swagger :param track_start: The track_start of this PlayLog. # noqa: E501 @@ -29,8 +29,10 @@ class PlayLog(Model): :type track_duration: int :param track_type: The track_type of this PlayLog. # noqa: E501 :type track_type: int - :param timeslot_id: The timeslot_id of this PlayLog. # noqa: E501 - :type timeslot_id: int + :param schedule_id: The schedule_id of this PlayLog. # noqa: E501 + :type schedule_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 :type show_name: str :param log_source: The log_source of this PlayLog. # noqa: E501 @@ -43,7 +45,8 @@ class PlayLog(Model): 'track_title': str, 'track_duration': int, 'track_type': int, - 'timeslot_id': int, + 'schedule_id': int, + 'show_id': int, 'show_name': str, 'log_source': int } @@ -55,7 +58,8 @@ class PlayLog(Model): 'track_title': 'track_title', 'track_duration': 'track_duration', 'track_type': 'track_type', - 'timeslot_id': 'timeslot_id', + 'schedule_id': 'schedule_id', + 'show_id': 'show_id', 'show_name': 'show_name', 'log_source': 'log_source' } @@ -65,7 +69,8 @@ class PlayLog(Model): self._track_title = track_title self._track_duration = track_duration self._track_type = track_type - self._timeslot_id = timeslot_id + self._schedule_id = schedule_id + self._show_id = show_id self._show_name = show_name self._log_source = log_source @@ -209,25 +214,46 @@ class PlayLog(Model): self._track_type = track_type @property - def timeslot_id(self): - """Gets the timeslot_id of this PlayLog. + def schedule_id(self): + """Gets the schedule_id of this PlayLog. - :return: The timeslot_id of this PlayLog. + :return: The schedule_id of this PlayLog. :rtype: int """ - return self._timeslot_id + return self._schedule_id - @timeslot_id.setter - def timeslot_id(self, timeslot_id): - """Sets the timeslot_id of this PlayLog. + @schedule_id.setter + def schedule_id(self, schedule_id): + """Sets the schedule_id of this PlayLog. - :param timeslot_id: The timeslot_id of this PlayLog. - :type timeslot_id: int + :param schedule_id: The schedule_id of this PlayLog. + :type schedule_id: int """ - self._timeslot_id = timeslot_id + self._schedule_id = schedule_id + + @property + def show_id(self): + """Gets the show_id of this PlayLog. + + + :return: The show_id of this PlayLog. + :rtype: int + """ + return self._show_id + + @show_id.setter + def show_id(self, show_id): + """Sets the show_id of this PlayLog. + + + :param show_id: The show_id of this PlayLog. + :type show_id: int + """ + + self._show_id = show_id @property def show_name(self): diff --git a/src/rest/models/playlist.py b/src/rest/models/playlist.py new file mode 100644 index 0000000000000000000000000000000000000000..8e297213fee49cac2fd6cc7017794aff49393039 --- /dev/null +++ b/src/rest/models/playlist.py @@ -0,0 +1,91 @@ +# 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.models.playlist_entry import PlaylistEntry # noqa: F401,E501 +from src.rest import util + + +class Playlist(Model): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + def __init__(self, playlist_id=None, entries=None): # noqa: E501 + """Playlist - a model defined in Swagger + + :param playlist_id: The playlist_id of this Playlist. # noqa: E501 + :type playlist_id: int + :param entries: The entries of this Playlist. # noqa: E501 + :type entries: List[PlaylistEntry] + """ + self.swagger_types = { + 'playlist_id': int, + 'entries': List[PlaylistEntry] + } + + self.attribute_map = { + 'playlist_id': 'playlist_id', + 'entries': 'entries' + } + self._playlist_id = playlist_id + self._entries = entries + + @classmethod + def from_dict(cls, dikt): + """Returns the dict as a model + + :param dikt: A dict. + :type: dict + :return: The Playlist of this Playlist. # noqa: E501 + :rtype: Playlist + """ + return util.deserialize_model(dikt, cls) + + @property + def playlist_id(self): + """Gets the playlist_id of this Playlist. + + + :return: The playlist_id of this Playlist. + :rtype: int + """ + return self._playlist_id + + @playlist_id.setter + def playlist_id(self, playlist_id): + """Sets the playlist_id of this Playlist. + + + :param playlist_id: The playlist_id of this Playlist. + :type playlist_id: int + """ + + self._playlist_id = playlist_id + + @property + def entries(self): + """Gets the entries of this Playlist. + + + :return: The entries of this Playlist. + :rtype: List[PlaylistEntry] + """ + return self._entries + + @entries.setter + def entries(self, entries): + """Sets the entries of this Playlist. + + + :param entries: The entries of this Playlist. + :type entries: List[PlaylistEntry] + """ + if entries is None: + raise ValueError("Invalid value for `entries`, must not be `None`") # noqa: E501 + + self._entries = entries diff --git a/src/rest/models/playlist_entry.py b/src/rest/models/playlist_entry.py new file mode 100644 index 0000000000000000000000000000000000000000..2842b2f97129730fa62c843f9cc0449fb993e2e4 --- /dev/null +++ b/src/rest/models/playlist_entry.py @@ -0,0 +1,194 @@ +# 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 PlaylistEntry(Model): + """NOTE: This class is auto generated by the swagger code generator program. + + 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): # noqa: E501 + """PlaylistEntry - a model defined in Swagger + + :param track_start: The track_start of this PlaylistEntry. # noqa: E501 + :type track_start: datetime + :param track_artist: The track_artist of this PlaylistEntry. # noqa: E501 + :type track_artist: str + :param track_album: The track_album of this PlaylistEntry. # noqa: E501 + :type track_album: str + :param track_title: The track_title of this PlaylistEntry. # noqa: E501 + :type track_title: str + :param track_duration: The track_duration of this PlaylistEntry. # noqa: E501 + :type track_duration: int + :param track_type: The track_type of this PlaylistEntry. # noqa: E501 + :type track_type: int + """ + self.swagger_types = { + 'track_start': datetime, + 'track_artist': str, + 'track_album': str, + 'track_title': str, + 'track_duration': int, + 'track_type': int + } + + self.attribute_map = { + 'track_start': 'track_start', + 'track_artist': 'track_artist', + 'track_album': 'track_album', + 'track_title': 'track_title', + 'track_duration': 'track_duration', + 'track_type': 'track_type' + } + self._track_start = track_start + self._track_artist = track_artist + self._track_album = track_album + self._track_title = track_title + self._track_duration = track_duration + self._track_type = track_type + + @classmethod + def from_dict(cls, dikt): + """Returns the dict as a model + + :param dikt: A dict. + :type: dict + :return: The PlaylistEntry of this PlaylistEntry. # noqa: E501 + :rtype: PlaylistEntry + """ + return util.deserialize_model(dikt, cls) + + @property + def track_start(self): + """Gets the track_start of this PlaylistEntry. + + + :return: The track_start of this PlaylistEntry. + :rtype: datetime + """ + return self._track_start + + @track_start.setter + def track_start(self, track_start): + """Sets the track_start of this PlaylistEntry. + + + :param track_start: The track_start of this PlaylistEntry. + :type track_start: datetime + """ + if track_start is None: + raise ValueError("Invalid value for `track_start`, must not be `None`") # noqa: E501 + + self._track_start = track_start + + @property + def track_artist(self): + """Gets the track_artist of this PlaylistEntry. + + + :return: The track_artist of this PlaylistEntry. + :rtype: str + """ + return self._track_artist + + @track_artist.setter + def track_artist(self, track_artist): + """Sets the track_artist of this PlaylistEntry. + + + :param track_artist: The track_artist of this PlaylistEntry. + :type track_artist: str + """ + + self._track_artist = track_artist + + @property + def track_album(self): + """Gets the track_album of this PlaylistEntry. + + + :return: The track_album of this PlaylistEntry. + :rtype: str + """ + return self._track_album + + @track_album.setter + def track_album(self, track_album): + """Sets the track_album of this PlaylistEntry. + + + :param track_album: The track_album of this PlaylistEntry. + :type track_album: str + """ + + self._track_album = track_album + + @property + def track_title(self): + """Gets the track_title of this PlaylistEntry. + + + :return: The track_title of this PlaylistEntry. + :rtype: str + """ + return self._track_title + + @track_title.setter + def track_title(self, track_title): + """Sets the track_title of this PlaylistEntry. + + + :param track_title: The track_title of this PlaylistEntry. + :type track_title: str + """ + + self._track_title = track_title + + @property + def track_duration(self): + """Gets the track_duration of this PlaylistEntry. + + + :return: The track_duration of this PlaylistEntry. + :rtype: int + """ + return self._track_duration + + @track_duration.setter + def track_duration(self, track_duration): + """Sets the track_duration of this PlaylistEntry. + + + :param track_duration: The track_duration of this PlaylistEntry. + :type track_duration: int + """ + + self._track_duration = track_duration + + @property + def track_type(self): + """Gets the track_type of this PlaylistEntry. + + + :return: The track_type of this PlaylistEntry. + :rtype: int + """ + return self._track_type + + @track_type.setter + def track_type(self, track_type): + """Sets the track_type of this PlaylistEntry. + + + :param track_type: The track_type of this PlaylistEntry. + :type track_type: int + """ + + self._track_type = track_type diff --git a/src/rest/models/schedule.py b/src/rest/models/schedule.py new file mode 100644 index 0000000000000000000000000000000000000000..25be6714092bf7578f393802df5902c14f14ee50 --- /dev/null +++ b/src/rest/models/schedule.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 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 deleted file mode 100644 index 04dcde3c82c72aa2d55e8a4d4b729cac1e36a224..0000000000000000000000000000000000000000 --- a/src/rest/models/timeslot.py +++ /dev/null @@ -1,253 +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.models.track import Track # noqa: F401,E501 -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, schedule_id=None, timeslot_id=None, timeslot_start=None, timeslot_end=None, playlist_id=None, fallback_type=None, tracks=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 schedule_id: The schedule_id of this Timeslot. # noqa: E501 - :type schedule_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 - :param tracks: The tracks of this Timeslot. # noqa: E501 - :type tracks: List[Track] - """ - self.swagger_types = { - 'show_name': str, - 'schedule_id': int, - 'timeslot_id': int, - 'timeslot_start': datetime, - 'timeslot_end': datetime, - 'playlist_id': int, - 'fallback_type': int, - 'tracks': List[Track] - } - - self.attribute_map = { - 'show_name': 'show_name', - 'schedule_id': 'schedule_id', - 'timeslot_id': 'timeslot_id', - 'timeslot_start': 'timeslot_start', - 'timeslot_end': 'timeslot_end', - 'playlist_id': 'playlist_id', - 'fallback_type': 'fallback_type', - 'tracks': 'tracks' - } - self._show_name = show_name - self._schedule_id = schedule_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 - self._tracks = tracks - - @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 schedule_id(self): - """Gets the schedule_id of this Timeslot. - - - :return: The schedule_id of this Timeslot. - :rtype: int - """ - return self._schedule_id - - @schedule_id.setter - def schedule_id(self, schedule_id): - """Sets the schedule_id of this Timeslot. - - - :param schedule_id: The schedule_id of this Timeslot. - :type schedule_id: int - """ - - self._schedule_id = schedule_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 - - @property - def tracks(self): - """Gets the tracks of this Timeslot. - - - :return: The tracks of this Timeslot. - :rtype: List[Track] - """ - return self._tracks - - @tracks.setter - def tracks(self, tracks): - """Sets the tracks of this Timeslot. - - - :param tracks: The tracks of this Timeslot. - :type tracks: List[Track] - """ - if tracks is None: - raise ValueError("Invalid value for `tracks`, must not be `None`") # noqa: E501 - - self._tracks = tracks diff --git a/src/rest/models/track.py b/src/rest/models/track.py index ac5a89579a9cac386bbf358a30e22ed9f490956c..0633f1e8abe965fc12166c8a6e7f74b5ecfc7d11 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): # noqa: E501 + def __init__(self, track_start=None, track_artist=None, track_album=None, track_title=None, track_duration=None, track_type=None, schedule_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 @@ -29,6 +29,12 @@ class Track(Model): :type track_duration: int :param track_type: The track_type of this Track. # noqa: E501 :type track_type: int + :param schedule_id: The schedule_id of this Track. # noqa: E501 + :type schedule_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 + :type show_name: str """ self.swagger_types = { 'track_start': datetime, @@ -36,7 +42,10 @@ class Track(Model): 'track_album': str, 'track_title': str, 'track_duration': int, - 'track_type': int + 'track_type': int, + 'schedule_id': int, + 'show_id': int, + 'show_name': str } self.attribute_map = { @@ -45,7 +54,10 @@ class Track(Model): 'track_album': 'track_album', 'track_title': 'track_title', 'track_duration': 'track_duration', - 'track_type': 'track_type' + 'track_type': 'track_type', + 'schedule_id': 'schedule_id', + 'show_id': 'show_id', + 'show_name': 'show_name' } self._track_start = track_start self._track_artist = track_artist @@ -53,6 +65,9 @@ class Track(Model): self._track_title = track_title self._track_duration = track_duration self._track_type = track_type + self._schedule_id = schedule_id + self._show_id = show_id + self._show_name = show_name @classmethod def from_dict(cls, dikt): @@ -192,3 +207,66 @@ class Track(Model): """ self._track_type = track_type + + @property + def schedule_id(self): + """Gets the schedule_id of this Track. + + + :return: The schedule_id of this Track. + :rtype: int + """ + return self._schedule_id + + @schedule_id.setter + def schedule_id(self, schedule_id): + """Sets the schedule_id of this Track. + + + :param schedule_id: The schedule_id of this Track. + :type schedule_id: int + """ + + self._schedule_id = schedule_id + + @property + def show_id(self): + """Gets the show_id of this Track. + + + :return: The show_id of this Track. + :rtype: int + """ + return self._show_id + + @show_id.setter + def show_id(self, show_id): + """Sets the show_id of this Track. + + + :param show_id: The show_id of this Track. + :type show_id: int + """ + + self._show_id = show_id + + @property + def show_name(self): + """Gets the show_name of this Track. + + + :return: The show_name of this Track. + :rtype: str + """ + return self._show_name + + @show_name.setter + def show_name(self, show_name): + """Sets the show_name of this Track. + + + :param show_name: The show_name of this Track. + :type show_name: str + """ + + self._show_name = show_name diff --git a/src/rest/swagger/swagger.yaml b/src/rest/swagger/swagger.yaml index 3a0d71d86f903fc5766a6d8e0b0d90bfc5150fe1..529c3f703dc0c8aee19905927bd2807dba15b758 100644 --- a/src/rest/swagger/swagger.yaml +++ b/src/rest/swagger/swagger.yaml @@ -72,7 +72,7 @@ paths: schema: type: array items: - $ref: '#/components/schemas/PlayLog' + $ref: '#/components/schemas/Track' x-content-type: application/json "400": description: bad input parameter @@ -91,7 +91,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/PlayLog' + $ref: '#/components/schemas/Track' "400": description: bad input parameter x-openapi-router-controller: src.rest.controllers.public_controller @@ -105,7 +105,7 @@ paths: operationId: clock_info responses: "200": - description: Schedule info for clock + description: Show, Schedule and Playlist info for the Studio Clock content: application/json: schema: @@ -113,6 +113,32 @@ paths: "400": description: bad input parameter x-openapi-router-controller: src.rest.controllers.internal_controller + /clock/{number}: + put: + tags: + - internal + summary: Set current studio clock information such as schedule info and track-list + for engine 1 or 2 + description: | + Set current studio clock information (schedule and track-list) of the given play-out source (engine1, engine2) + operationId: set_clock_info + parameters: + - name: number + in: path + description: Number of the engine + required: true + style: simple + explode: false + schema: + maximum: 2 + minimum: 1 + type: integer + responses: + "200": + description: status updated + "400": + description: bad input parameter + x-openapi-router-controller: src.rest.controllers.internal_controller /playlog/store: post: tags: @@ -364,13 +390,25 @@ components: track_type: type: integer example: 2 + schedule_id: + type: integer + example: 23 + show_id: + type: integer + example: 42 + show_name: + type: string + example: Electronic Music from Brazil example: track_album: '...And the Circus Leaves Town' + show_id: 42 track_start: 2020-08-29T09:12:33.001Z track_title: El Rodeo + show_name: Electronic Music from Brazil track_artist: Kyuss track_duration: 303 track_type: 2 + schedule_id: 23 PlayLog: required: - track_start @@ -395,9 +433,12 @@ components: track_type: type: integer example: 2 - timeslot_id: + schedule_id: type: integer - example: 1 + example: 23 + show_id: + type: integer + example: 42 show_name: type: string example: Electronic Music from Brazil @@ -406,14 +447,15 @@ components: example: 1 example: track_album: Bricolage + show_id: 42 track_start: 2020-08-29T09:12:33.001Z track_title: Chomp Samba show_name: Electronic Music from Brazil log_source: 1 track_artist: Amon Tobin - timeslot_id: 1 track_duration: 808 track_type: 2 + schedule_id: 23 HealthLog: required: - details @@ -436,70 +478,77 @@ components: details: Stringified JSON Object log_time: 2020-08-29T09:12:33.001Z ClockInfo: - required: - - current_timeslot type: object properties: + engine_source: + type: integer + example: 1 current_track: $ref: '#/components/schemas/PlayLog' - current_timeslot: - $ref: '#/components/schemas/Timeslot' - next_timeslot: - $ref: '#/components/schemas/Timeslot' + current_playlist: + $ref: '#/components/schemas/Playlist' + current_schedule: + $ref: '#/components/schemas/Schedule' + next_schedule: + $ref: '#/components/schemas/Schedule' example: - current_timeslot: - timeslot_end: 2020-08-29T09:12:33.001Z - playlist_id: 38 - show_name: Future Pop - fallback_type: 0 - timeslot_start: 2020-08-29T09:12:33.001Z - timeslot_id: 42 - schedule_id: 23 - tracks: - - track_album: '...And the Circus Leaves Town' + engine_source: 1 + current_playlist: + entries: + - track_album: Bricolage track_start: 2020-08-29T09:12:33.001Z - track_title: El Rodeo - track_artist: Kyuss - track_duration: 303 + track_title: Chomp Samba + track_artist: Amon Tobin + track_duration: 808 track_type: 2 - - track_album: '...And the Circus Leaves Town' + - track_album: Bricolage track_start: 2020-08-29T09:12:33.001Z - track_title: El Rodeo - track_artist: Kyuss - track_duration: 303 + track_title: Chomp Samba + track_artist: Amon Tobin + track_duration: 808 track_type: 2 + playlist_id: 38 current_track: track_album: Bricolage + show_id: 42 track_start: 2020-08-29T09:12:33.001Z track_title: Chomp Samba show_name: Electronic Music from Brazil log_source: 1 track_artist: Amon Tobin - timeslot_id: 1 track_duration: 808 track_type: 2 - Timeslot: + schedule_id: 23 + 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: required: + - schedule_end + - schedule_start - show_name - - timeslot_end - - timeslot_start - - tracks type: object properties: show_name: type: string - example: Future Pop + example: Electronic Music from Brazil + show_id: + type: integer + example: 42 schedule_id: type: integer example: 23 - timeslot_id: - type: integer - example: 42 - timeslot_start: + schedule_start: type: string format: date-time example: 2020-08-29T09:12:33.001Z - timeslot_end: + schedule_end: type: string format: date-time example: 2020-08-29T09:12:33.001Z @@ -509,31 +558,72 @@ components: fallback_type: type: integer example: 0 - tracks: - type: array - items: - $ref: '#/components/schemas/Track' example: - timeslot_end: 2020-08-29T09:12:33.001Z + show_id: 42 playlist_id: 38 - show_name: Future Pop + show_name: Electronic Music from Brazil fallback_type: 0 - timeslot_start: 2020-08-29T09:12:33.001Z - timeslot_id: 42 + schedule_end: 2020-08-29T09:12:33.001Z schedule_id: 23 - tracks: - - track_album: '...And the Circus Leaves Town' + schedule_start: 2020-08-29T09:12:33.001Z + Playlist: + required: + - entries + type: object + properties: + playlist_id: + type: integer + example: 38 + entries: + type: array + items: + $ref: '#/components/schemas/PlaylistEntry' + example: + entries: + - track_album: Bricolage track_start: 2020-08-29T09:12:33.001Z - track_title: El Rodeo - track_artist: Kyuss - track_duration: 303 + track_title: Chomp Samba + track_artist: Amon Tobin + track_duration: 808 track_type: 2 - - track_album: '...And the Circus Leaves Town' + - track_album: Bricolage track_start: 2020-08-29T09:12:33.001Z - track_title: El Rodeo - track_artist: Kyuss - track_duration: 303 + track_title: Chomp Samba + track_artist: Amon Tobin + track_duration: 808 track_type: 2 + playlist_id: 38 + PlaylistEntry: + required: + - track_start + type: object + properties: + track_start: + type: string + format: date-time + example: 2020-08-29T09:12:33.001Z + track_artist: + type: string + example: Amon Tobin + track_album: + type: string + example: Bricolage + track_title: + type: string + example: Chomp Samba + track_duration: + type: integer + example: 808 + track_type: + type: integer + example: 2 + example: + track_album: Bricolage + track_start: 2020-08-29T09:12:33.001Z + track_title: Chomp Samba + track_artist: Amon Tobin + track_duration: 808 + track_type: 2 inline_response_400: type: object properties: diff --git a/src/rest/test/test_internal_controller.py b/src/rest/test/test_internal_controller.py index bc70005d36723b71cb68aa180dc0da86bd2f7ac5..0f2b586fe27d0fd7e06a417fbca180169be70892 100644 --- a/src/rest/test/test_internal_controller.py +++ b/src/rest/test/test_internal_controller.py @@ -128,7 +128,18 @@ class TestInternalController(BaseTestCase): Set active play-out source (engine1, engine2) """ response = self.client.open( - '/api/v1/source/active/{number}'.format(number=2), + '/source/active/{number}'.format(number=2), + method='PUT') + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) + + 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 + """ + response = self.client.open( + '/clock/{number}'.format(number=2), method='PUT') self.assert200(response, 'Response body is : ' + response.data.decode('utf-8')) diff --git a/src/rest/test/test_public_controller.py b/src/rest/test/test_public_controller.py index fb9731cccaa5a77ae5c3ad26c2f5f8daed85af14..d5b132b1ca42c23065a31fce9d97012be26d1095 100644 --- a/src/rest/test/test_public_controller.py +++ b/src/rest/test/test_public_controller.py @@ -22,7 +22,7 @@ from __future__ import absolute_import from flask import json from six import BytesIO -from src.rest.models.play_log import PlayLog # noqa: E501 +from src.rest.models.track import Track # noqa: E501 from src.rest.test import BaseTestCase