mirror of
https://github.com/Schrolli91/BOSWatch.git
synced 2026-04-05 14:35:17 +00:00
Merge branch 'develop' into patch-1
This commit is contained in:
commit
0ab896b17a
18 changed files with 168 additions and 105 deletions
|
|
@ -126,7 +126,7 @@ def decode(freq, decoded):
|
|||
# If enabled, look up description
|
||||
if globalVars.config.getint("POC", "idDescribed"):
|
||||
from includes import descriptionList
|
||||
data["description"] = descriptionList.getDescription("POC", poc_id)
|
||||
data["description"] = descriptionList.getDescription("POC", poc_id+data["functionChar"])
|
||||
# processing the alarm
|
||||
try:
|
||||
from includes import alarmHandler
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ Function to expand the dataset with a description.
|
|||
|
||||
import logging # Global logger
|
||||
import csv # for loading the description files
|
||||
import re # for matching IDs with a regular expression
|
||||
|
||||
from includes import globalVars # Global variables
|
||||
from includes.helper import stringConverter
|
||||
|
|
@ -41,10 +42,10 @@ def loadCSV(typ, idField):
|
|||
reader = csv.DictReader(csvfile)
|
||||
for row in reader:
|
||||
logging.debug(row)
|
||||
# only import rows with an integer as id
|
||||
if row[idField].isdigit() == True:
|
||||
# only import rows with an integer as id, allow subrics though
|
||||
if re.match("^[0-9]+[A-D]?$", row[idField], re.IGNORECASE):
|
||||
try:
|
||||
resultList[row[idField]] = stringConverter.convertToUTF8(row['description'])
|
||||
resultList[row[idField].lower()] = stringConverter.convertToUTF8(row['description'])
|
||||
except:
|
||||
# skip entry in case of an exception
|
||||
pass
|
||||
|
|
@ -112,7 +113,8 @@ def getDescription(typ, data):
|
|||
resultStr = zveiDescribtionList[data]
|
||||
elif typ == "POC":
|
||||
global ricDescribtionList
|
||||
resultStr = ricDescribtionList[data]
|
||||
resultStr = ricDescribtionList[data[:-1]] # MainRIC
|
||||
resultStr += " " + ricDescribtionList[data] # SubRIC
|
||||
else:
|
||||
logging.warning("Invalid Typ: %s", typ)
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ Global variables
|
|||
"""
|
||||
|
||||
# version info
|
||||
versionNr = "2.2"
|
||||
versionNr = "2.2-dev"
|
||||
buildDate = "2017/03/30"
|
||||
|
||||
# Global variables
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ from includes import globalVars
|
|||
from includes.helper import timeHandler
|
||||
|
||||
|
||||
def replaceWildcards(text, data, lineBrakeAllowed=False):
|
||||
def replaceWildcards(text, data):
|
||||
"""
|
||||
Replace all official Wildcards with the Information from the data[] var
|
||||
|
||||
|
|
@ -25,8 +25,6 @@ def replaceWildcards(text, data, lineBrakeAllowed=False):
|
|||
@param text: Input text with wildcards
|
||||
@type data: map
|
||||
@param data: map of data (structure see readme.md in plugin folder)
|
||||
@type lineBrakeAllowed: Boolean
|
||||
@param lineBrakeAllowed: switch to allow lineBreak (%BR%) as wildcard
|
||||
|
||||
@return: text with replaced wildcards
|
||||
@exception: Exception if Error at replace
|
||||
|
|
@ -36,8 +34,7 @@ def replaceWildcards(text, data, lineBrakeAllowed=False):
|
|||
text = text.replace("%TIME%", timeHandler.getTime(data["timestamp"])).replace("%DATE%", timeHandler.getDate(data["timestamp"]))
|
||||
|
||||
# replace some special chars
|
||||
if lineBrakeAllowed == True:
|
||||
text = text.replace("%BR%", "\r\n")
|
||||
text = text.replace("%BR%", "\r\n")
|
||||
text = text.replace("%LPAR%", "(")
|
||||
text = text.replace("%RPAR%", ")")
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue