From 53db7e744a450fb666783757879d6f7aec1dd593 Mon Sep 17 00:00:00 2001 From: Tim Date: Sat, 12 Feb 2022 18:00:27 +0000 Subject: [PATCH] Cleanup and add defaults --- scripts/alert.json | 17 +++++++++++++++++ scripts/alert.yaml | 6 ------ scripts/live_item.json | 6 ++++++ scripts/live_item.yaml | 4 ---- scripts/media.json | 33 +++++++++++++++++++++++++++++++++ scripts/media.yaml | 21 --------------------- scripts/test.json | 34 ++++++++++++++++++++++++++++++++++ scripts/test.yaml | 25 ------------------------- test_api/apitest/runner.py | 6 +++--- 9 files changed, 93 insertions(+), 59 deletions(-) create mode 100644 scripts/alert.json delete mode 100644 scripts/alert.yaml create mode 100644 scripts/live_item.json delete mode 100644 scripts/live_item.yaml create mode 100644 scripts/media.json delete mode 100644 scripts/media.yaml create mode 100644 scripts/test.json delete mode 100644 scripts/test.yaml diff --git a/scripts/alert.json b/scripts/alert.json new file mode 100644 index 0000000..e23a3ce --- /dev/null +++ b/scripts/alert.json @@ -0,0 +1,17 @@ +{ + "process_name": "Show basic alert process", + "step1": { + "name": "trigger_alert", + "payload": { + "text": "Some Text", + "min": 0 + } + }, + "step2": { + "name": "trigger_alert", + "payload": { + "text": "Some more text Text", + "delay": 5 + } + } +} \ No newline at end of file diff --git a/scripts/alert.yaml b/scripts/alert.yaml deleted file mode 100644 index d1f7e61..0000000 --- a/scripts/alert.yaml +++ /dev/null @@ -1,6 +0,0 @@ ---- -process_name: Show basic alert process -step1: - payload: - text: Show some text - name: trigger_alert diff --git a/scripts/live_item.json b/scripts/live_item.json new file mode 100644 index 0000000..5ee0862 --- /dev/null +++ b/scripts/live_item.json @@ -0,0 +1,6 @@ +{ + "process_name": "live_item", + "step1": { + "name": "play_live_items" + } +} \ No newline at end of file diff --git a/scripts/live_item.yaml b/scripts/live_item.yaml deleted file mode 100644 index f9f2957..0000000 --- a/scripts/live_item.yaml +++ /dev/null @@ -1,4 +0,0 @@ ---- -process_name: live_item -step1: - name: play_live_items diff --git a/scripts/media.json b/scripts/media.json new file mode 100644 index 0000000..2f80be5 --- /dev/null +++ b/scripts/media.json @@ -0,0 +1,33 @@ +{ + "process_name": "play media", + "step1": { + "name": "clear_live_controller", + "payload": { + "max": 1, + "min": 1 + } + }, + "step2": { + "name": "clear_preview_controller", + "payload": { + "delay": 1 + } + }, + "step3": { + "name": "search_and_add", + "delay": 10 + "payload": { + "plugin": "media" + } + }, + "step4": { + "name": "load_service_sequential" + }, + "step5": { + "delay": 30 + "name": "flush_pending" + }, + "step6": { + "name": "media_pause" + } +} \ No newline at end of file diff --git a/scripts/media.yaml b/scripts/media.yaml deleted file mode 100644 index d2f40b5..0000000 --- a/scripts/media.yaml +++ /dev/null @@ -1,21 +0,0 @@ ---- -process_name: play media -step1: - max: 1 - min: 1 - name: clear_live_controller -step2: - delay: 1 - name: clear_preview_controller -step3: - delay: 10 - name: search_and_add - payload: - plugin: media -step4: - name: load_service_sequential -step5: - delay: 30 - name: flush_pending -step6: - name: media_pause diff --git a/scripts/test.json b/scripts/test.json new file mode 100644 index 0000000..3f24bfa --- /dev/null +++ b/scripts/test.json @@ -0,0 +1,34 @@ +{ + "process_name": "play media", + "step1": { + "name": "clear_live_controller", + "max": 1, + "min": 1 + }, + "step2": { + "name": "clear_preview_controller", + "delay": 1 + }, + "step3": { + "name": "new_service", + "max": 1, + "min": 1 + }, + "step4": { + "name": "search_and_add", + "delay": 1, + "payload": { + "plugin": "songs" + } + }, + "step5": { + "name": "search_and_add", + "delay": 1, + "payload": { + "plugin": "bibles" + } + }, + "step6": { + "name": "load_service_sequential" + } +} \ No newline at end of file diff --git a/scripts/test.yaml b/scripts/test.yaml deleted file mode 100644 index 91ad246..0000000 --- a/scripts/test.yaml +++ /dev/null @@ -1,25 +0,0 @@ ---- -process_name: test process -step1: - max: 1 - min: 1 - name: clear_live_controller -step2: - delay: 1 - name: clear_preview_controller -step3: - max: 1 - min: 1 - name: new_service -step4: - delay: 1 - name: search_and_add - payload: - plugin: songs -step5: - delay: 1 - name: search_and_add - payload: - plugin: bibles -step6: - name: load_service_sequential diff --git a/test_api/apitest/runner.py b/test_api/apitest/runner.py index 755ec59..44a3434 100644 --- a/test_api/apitest/runner.py +++ b/test_api/apitest/runner.py @@ -20,7 +20,7 @@ import argparse import threading import websocket -import yaml +import json from collections import deque from websocket import create_connection @@ -82,7 +82,7 @@ class RunTestsController(object): print_info(f"Socket Listener Opened") @staticmethod - def on_close() -> None: + def on_close(ws_obj: object) -> None: print_info("Socket Listener Closed") @staticmethod @@ -119,7 +119,7 @@ class RunTestsController(object): f_open = f'{a.rargs[0]}' print(f_open) with open(f_open, 'r') as file: - commands = yaml.load(file, Loader=yaml.SafeLoader) + commands = json.load(file) for step in commands: if step == 'process_name': print_info(f'Processing file {commands[step]}')