From b1a3a68e35b5e35e62f9c19ee2365bd0b2365f2b Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Tue, 26 Feb 2019 15:16:52 +0100 Subject: [PATCH] first yaml test --- config/client.yaml | 49 ++++++++++++++++++++++++++++++++++++++++++++++ yaml_test.py | 28 ++++++++++++++++++++++++++ 2 files changed, 77 insertions(+) create mode 100644 config/client.yaml create mode 100644 yaml_test.py diff --git a/config/client.yaml b/config/client.yaml new file mode 100644 index 0000000..5358312 --- /dev/null +++ b/config/client.yaml @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +# ____ ____ ______ __ __ __ _____ +# / __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ / +# / __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ < +# / /_/ / /_/ /___/ /| |/ |/ / /_/ / /_/ /__/ / / / ___/ / +#/_____/\____//____/ |__/|__/\__,_/\__/\___/_/ /_/ /____/ +# German BOS Information Script +# by Bastian Schroll + +client: + name: "BW3 Client" + inputSource: "stick" + +server: + - name: "Server one" + ip: "127.0.0.1" + port: 8080 + + - name: "Server two" + ip: "11.12.13.14" + port: 5000 + +# stick or audio +inputSource: + stick: + device: 0 + frequency: "85.000M" + PPMError: 0 + Squelch: 0 + Gain: 100 + audio: + +decoder: + fms: yes + zvei: yes + poc512: yes + poc1200: yes + poc2400: yes + +doubleFilter: + - name: "Filter one" + MaxEntry: 30 + IgnoreTime: 10 + CheckMsg: no + - name: "Filter two" + MaxEntry: 30 + IgnoreTime: 10 + CheckMsg: no + diff --git a/yaml_test.py b/yaml_test.py new file mode 100644 index 0000000..175d63d --- /dev/null +++ b/yaml_test.py @@ -0,0 +1,28 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +"""! + ____ ____ ______ __ __ __ _____ + / __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ / + / __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ < + / /_/ / /_/ /___/ /| |/ |/ / /_/ / /_/ /__/ / / / ___/ / +/_____/\____//____/ |__/|__/\__,_/\__/\___/_/ /_/ /____/ + German BOS Information Script + by Bastian Schroll +""" + +import yaml +import pprint +pp = pprint.PrettyPrinter(indent=4) + +with open('config/client.yaml') as f: + # use safe_load instead load + dataMap = yaml.safe_load(f) + +pp.pprint(dataMap) + + +#print(dataMap["decoder"]["fms"]) + +for server in dataMap["server"]: + print(server["ip"]) +