BW3-Core/boswatch/utils/misc.py

55 lines
1.8 KiB
Python
Raw Normal View History

2019-03-11 07:47:51 +01:00
#!/usr/bin/python
# -*- coding: utf-8 -*-
r"""!
2019-03-11 07:47:51 +01:00
____ ____ ______ __ __ __ _____
/ __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ /
/ __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ <
/ /_/ / /_/ /___/ /| |/ |/ / /_/ / /_/ /__/ / / / ___/ /
/_____/\____//____/ |__/|__/\__,_/\__/\___/_/ /_/ /____/
German BOS Information Script
by Bastian Schroll
@file: misc.py
@date: 11.03.2019
@author: Bastian Schroll
@description: Some misc functions
"""
import logging
2019-03-11 11:04:58 +01:00
from boswatch.utils import version
2019-03-11 07:47:51 +01:00
logging.debug("- %s loaded", __name__)
def addClientDataToPacket(bwPacket, config):
r"""!Add the client information to the decoded data
2019-03-11 07:47:51 +01:00
This function adds the following data to the bwPacket:
- clientName
- clientVersion
- clientBuildDate
- clientBranch
- inputSource
- frequency"""
logging.debug("add client data to bwPacket")
bwPacket.set("clientName", config.get("client", "name"))
bwPacket.set("clientVersion", version.client)
bwPacket.set("clientBuildDate", version.date)
bwPacket.set("clientBranch", version.branch)
2019-10-18 21:48:57 +02:00
bwPacket.set("inputSource", config.get("client", "inputSource"))
2019-03-11 07:47:51 +01:00
bwPacket.set("frequency", config.get("inputSource", "sdr", "frequency"))
def addServerDataToPacket(bwPacket, config):
r"""!Add the server information to the decoded data
2019-03-11 07:47:51 +01:00
This function adds the following data to the bwPacket:
- serverName
- serverVersion
- serverBuildDate
- serverBranch"""
logging.debug("add server data to bwPacket")
bwPacket.set("serverName", config.get("server", "name"))
bwPacket.set("serverVersion", version.server)
bwPacket.set("serverBuildDate", version.date)
bwPacket.set("serverBranch", version.branch)