mirror of
https://github.com/Schrolli91/BOSWatch.git
synced 2026-04-21 06:13:39 +00:00
update parameters for httpRequest plugin
This commit is contained in:
parent
8b744c1a46
commit
8c5cb8ec85
2 changed files with 29 additions and 8 deletions
|
|
@ -127,19 +127,24 @@ tablePOC = bos_pocsag
|
||||||
|
|
||||||
# %FMS% = FMS Code
|
# %FMS% = FMS Code
|
||||||
# %STATUS% = FMS Status
|
# %STATUS% = FMS Status
|
||||||
# %DIR% = Direction of the telegram
|
# %DIR% = Direction of the telegram (0/1)
|
||||||
# %TSI% = Tactical Short Information
|
# %DIRT% = Direction of the telegram (Text-String)
|
||||||
|
# %TSI% = Tactical Short Information (I-IV)
|
||||||
|
# %TIME% = Date/Time (by script)
|
||||||
#fms_url = www.google.de?code=%FMS%&stat=%STATUS%
|
#fms_url = www.google.de?code=%FMS%&stat=%STATUS%
|
||||||
fms_url =
|
fms_url =
|
||||||
|
|
||||||
# %ZVEI% = ZVEI 5-tone Code
|
# %ZVEI% = ZVEI 5-tone Code
|
||||||
|
# %TIME% = Date/Time (by script)
|
||||||
#zvei_url = www.google.de?zvei=%ZVEI%
|
#zvei_url = www.google.de?zvei=%ZVEI%
|
||||||
zvei_url =
|
zvei_url =
|
||||||
|
|
||||||
# %RIC% = Pocsag RIC
|
# %RIC% = Pocsag RIC
|
||||||
# %FUNC% = Pocsac function/Subric
|
# %FUNC% = Pocsac function/Subric (1-4)
|
||||||
|
# %FUNCCHAR% = Pocsac function/Subric als character (a-d)
|
||||||
# %MSG% = Message of the Pocsag telegram
|
# %MSG% = Message of the Pocsag telegram
|
||||||
# %BITRATE% = Bitrate of the Pocsag telegram
|
# %BITRATE% = Bitrate of the Pocsag telegram
|
||||||
|
# %TIME% = Date/Time (by script)
|
||||||
#poc_url = www.google.de?ric=%RIC%&subric=%FUNC%&msg=%MSG%
|
#poc_url = www.google.de?ric=%RIC%&subric=%FUNC%&msg=%MSG%
|
||||||
poc_url =
|
poc_url =
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ httpRequest-Plugin to dispatch FMS-, ZVEI- and POCSAG - messages to an URL
|
||||||
@requires: httpRequest-Configuration has to be set in the config.ini
|
@requires: httpRequest-Configuration has to be set in the config.ini
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import time
|
||||||
import logging # Global logger
|
import logging # Global logger
|
||||||
import httplib #for the HTTP request
|
import httplib #for the HTTP request
|
||||||
from urlparse import urlparse #for split the URL into url and path
|
from urlparse import urlparse #for split the URL into url and path
|
||||||
|
|
@ -31,6 +32,13 @@ def onLoad():
|
||||||
"""
|
"""
|
||||||
# nothing to do for this plugin
|
# nothing to do for this plugin
|
||||||
return
|
return
|
||||||
|
|
||||||
|
##
|
||||||
|
#
|
||||||
|
# Private helper function for a printable Timestamp
|
||||||
|
#
|
||||||
|
def curtime():
|
||||||
|
return time.strftime("%Y-%m-%d %H:%M:%S")
|
||||||
|
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
@ -75,15 +83,23 @@ def run(typ,freq,data):
|
||||||
|
|
||||||
if typ == "FMS":
|
if typ == "FMS":
|
||||||
url = globals.config.get("httpRequest", "fms_url") #Get URL
|
url = globals.config.get("httpRequest", "fms_url") #Get URL
|
||||||
url = url.replace("%FMS%", data["fms"]).replace("%STATUS%", data["status"]) #replace Wildcards in URL
|
url = url.replace("%FMS%", data["fms"]).replace("%STATUS%", data["status"]) #replace Wildcards
|
||||||
url = url.replace("%DIR%", data["direction"]).replace("%TSI%", data["tsi"]) #replace Wildcards in URL
|
url = url.replace("%DIR%", data["direction"]).replace("%DIRT%", data["directionText"]) #replace Wildcards
|
||||||
|
url = url.replace("%TSI%", data["tsi"]) #replace Wildcards
|
||||||
|
url = url.replace("%DESCR%", data["description"]) # replace Wildcards
|
||||||
|
url = url.replace("%TIME%", curtime()) # replace Wildcards
|
||||||
elif typ == "ZVEI":
|
elif typ == "ZVEI":
|
||||||
url = globals.config.get("httpRequest", "zvei_url") #Get URL
|
url = globals.config.get("httpRequest", "zvei_url") #Get URL
|
||||||
url = url.replace("%ZVEI%", data["zvei"]) #replace Wildcards in URL
|
url = url.replace("%ZVEI%", data["zvei"]) #replace Wildcards
|
||||||
|
url = url.replace("%DESCR%", data["description"]) # replace Wildcards
|
||||||
|
url = url.replace("%TIME%", curtime()) # replace Wildcards
|
||||||
elif typ == "POC":
|
elif typ == "POC":
|
||||||
url = globals.config.get("httpRequest", "poc_url") #Get URL
|
url = globals.config.get("httpRequest", "poc_url") #Get URL
|
||||||
url = url.replace("%RIC%", data["ric"]).replace("%FUNC%", data["function"]) #replace Wildcards in URL
|
url = url.replace("%RIC%", data["ric"]) #replace Wildcards
|
||||||
url = url.replace("%MSG%", data["msg"]).replace("%BITRATE%", data["bitrate"]) #replace Wildcards in URL
|
url = url.replace("%FUNC%", data["function"]).replace("%FUNCCHAR%", data["functionChar"]) #replace Wildcards
|
||||||
|
url = url.replace("%MSG%", data["msg"]).replace("%BITRATE%", str(data["bitrate"])) #replace Wildcards
|
||||||
|
url = url.replace("%DESCR%", data["description"]) # replace Wildcards
|
||||||
|
url = url.replace("%TIME%", curtime()) # replace Wildcards
|
||||||
else:
|
else:
|
||||||
logging.warning("Invalid Typ: %s", typ)
|
logging.warning("Invalid Typ: %s", typ)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue