add data['timestamp'] #72

to make sure, that all Plugins use the same timestamp
This commit is contained in:
JHCD 2015-07-31 19:09:27 +02:00
parent 28936d68ec
commit e7b5bffdd3
8 changed files with 38 additions and 17 deletions

View file

@ -84,13 +84,13 @@ def run(typ,freq,data):
logging.debug("Insert %s", typ)
if typ == "FMS":
cursor.execute("INSERT INTO "+globals.config.get("MySQL","tableFMS")+" (time, fms, status, direction, directionText, tsi, description) VALUES (NOW(),%s,%s,%s,%s,%s,%s)", (data["fms"], data["status"], data["direction"], data["directionText"], data["tsi"], data["description"]))
cursor.execute("INSERT INTO "+globals.config.get("MySQL","tableFMS")+" (time, fms, status, direction, directionText, tsi, description) VALUES (FROM_UNIXTIME(%s),%s,%s,%s,%s,%s,%s)", (data["timestamp"], data["fms"], data["status"], data["direction"], data["directionText"], data["tsi"], data["description"]))
elif typ == "ZVEI":
cursor.execute("INSERT INTO "+globals.config.get("MySQL","tableZVEI")+" (time, zvei, description) VALUES (NOW(),%s,%s)", (data["zvei"], data["description"]))
cursor.execute("INSERT INTO "+globals.config.get("MySQL","tableZVEI")+" (time, zvei, description) VALUES (FROM_UNIXTIME(%s),%s,%s)", (data["timestamp"], data["zvei"], data["description"]))
elif typ == "POC":
cursor.execute("INSERT INTO "+globals.config.get("MySQL","tablePOC")+" (time, ric, function, functionChar, msg, bitrate, description) VALUES (NOW(),%s,%s,%s,%s,%s,%s)", (data["ric"], data["function"], data["functionChar"], data["msg"], data["bitrate"], data["description"]))
cursor.execute("INSERT INTO "+globals.config.get("MySQL","tablePOC")+" (time, ric, function, functionChar, msg, bitrate, description) VALUES (FROM_UNIXTIME(%s),%s,%s,%s,%s,%s,%s)", (data["timestamp"], data["ric"], data["function"], data["functionChar"], data["msg"], data["bitrate"], data["description"]))
else:
logging.warning("Invalid Typ: %s", typ)

View file

@ -173,6 +173,7 @@ In the data map are the folowing informations:
**ZVEI:**
- zvei
- description
- timestamp
**FMS:**
- fms
@ -181,6 +182,7 @@ In the data map are the folowing informations:
- directionText
- tsi
- description
- timestamp
**POCSAG:**
- ric
@ -189,3 +191,4 @@ In the data map are the folowing informations:
- msg
- bitrate
- description
- timestamp

View file

@ -11,7 +11,6 @@ eMail-Plugin to dispatch FMS-, ZVEI- and POCSAG - messages via eMail/SMTP
import logging # Global logger
import time
import smtplib #for the SMTP client
from email.mime.text import MIMEText # Import the email modules we'll need
from email.utils import formatdate # need for confirm to RFC2822 standard

View file

@ -16,7 +16,6 @@ from urlparse import urlparse #for split the URL into url and path
from includes import globals # Global variables
from includes.helper import timeHandler
from includes.helper import wildcardHandler
from includes.helper import configHandler

View file

@ -209,7 +209,7 @@ def run(typ,freq,data):
# build event and msg
# pyNMA expect strings are not in UTF-8
event = stringConverter.convertToUnicode(data['description'])
msg = timeHandler.curtime()
msg = timeHandler.getDateTime(data['timestamp'])
if ("POC" in typ) and (len(data['msg']) > 0):
msg += "\n" + data['msg']
msg = stringConverter.convertToUnicode(msg)