From 3065221d6e737b381a971c867b33339ac316fb86 Mon Sep 17 00:00:00 2001 From: David Trattnig <david.trattnig@o94.at> Date: Thu, 27 Aug 2020 13:18:45 +0200 Subject: [PATCH] Call clock service methods. #6 --- src/rest/controllers/internal_controller.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/rest/controllers/internal_controller.py b/src/rest/controllers/internal_controller.py index 6e3fd8f..d018861 100644 --- a/src/rest/controllers/internal_controller.py +++ b/src/rest/controllers/internal_controller.py @@ -35,7 +35,8 @@ def clock_info(): # noqa: E501 :rtype: ClockInfo """ - return 'do some magic!' + service = current_app.config['SERVICE'] + return service.get_clock_info() def get_active_source(): # noqa: E501 @@ -140,14 +141,17 @@ def set_active_source(number): # noqa: E501 return service.set_active_source(number) -def set_clock_info(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 (schedule and track-list) of the given play-out source (engine1, engine2) # noqa: E501 + 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 populated in the GET request. To store current track information use `/playlog/store` instead. # noqa: E501 - :param number: Number of the engine - :type number: int + :param body: + :type body: dict | bytes :rtype: None """ - return 'do some magic!' + if connexion.request.is_json: + body = ClockInfo.from_dict(connexion.request.get_json()) # noqa: E501 + service = current_app.config['SERVICE'] + return service.set_clock_info(body) -- GitLab