diff --git a/config/config.template.ini b/config/config.template.ini index 41667f9..56cdd0f 100644 --- a/config/config.template.ini +++ b/config/config.template.ini @@ -43,10 +43,14 @@ filter_range_end = 9999999 [Filters] #RegEX Filter Configuration #No Filter for a Typ/Plugin Combination = all Data pass -#INDIVIDUAL_NAME = TYP;PLUGIN;REGEX +#INDIVIDUAL_NAME = TYP;DATAFIELD;PLUGIN;REGEX +TYP = the Data Typ (FMS|ZVEI|POC) +DATAFIELD = the field of the Data Array. See interface.txt for names. +PLUGIN = the name of the Plugin to call with this Filter. +REGEX = the RegEX #only ZVEI to template with 25### -#testfilter = ZVEI;template;25[0-9F]{3} +#testfilter = ZVEI;zvei;template;25[0-9F]{3} [Plugins] diff --git a/includes/filter.py b/includes/filter.py index 6643d54..24b1af7 100644 --- a/includes/filter.py +++ b/includes/filter.py @@ -14,7 +14,7 @@ def getFilters(): for key,val in globals.config.items("Filters"): logging.debug(" - %s = %s", key, val) filter = val.split(";") - globals.filterList.append({"name": key, "typ": filter[0], "plugin": filter[1], "regex": filter[2]}) + globals.filterList.append({"name": key, "typ": filter[0], "dataField": filter[1], "plugin": filter[2], "regex": filter[3]}) except: logging.exception("cannot read config file") @@ -23,17 +23,12 @@ def checkFilters(data,typ,plugin): try: logging.debug("search Filter for %s to %s", typ, plugin) - #extract the correct data for filtering - if typ == "FMS": data = data["fms"] - if typ == "ZVEI": data = data["zvei"] - if typ == "POC": data = data["ric"] - foundFilter = False for i in globals.filterList: if i["typ"] == typ and i["plugin"] == plugin: foundFilter = True logging.debug("found Filter: %s = %s", i["name"], i["regex"]) - if re.search(i["regex"], data): + if re.search(i["regex"], data[i["dataField"]]): logging.debug("Filter passed: %s", i["name"]) return True else: