mirror of
https://github.com/Schrolli91/BOSWatch.git
synced 2025-12-06 07:42:03 +01:00
commit
cbce582379
|
|
@ -399,6 +399,46 @@ RICforLocationAPIKey =
|
|||
# Required if you want to create a map based on location information received with the above RIC.
|
||||
GoogleAPIKey =
|
||||
|
||||
[yowsup]
|
||||
# number or chat-number who whants to become the news
|
||||
empfaenger =
|
||||
# WhatsApp-number of that the news comes
|
||||
sender =
|
||||
# password from this number
|
||||
password=
|
||||
|
||||
# %FMS% = FMS Code
|
||||
# %STATUS% = FMS Status
|
||||
# %DIR% = Direction of the telegram (0/1)
|
||||
# %DIRT% = Direction of the telegram (Text-String)
|
||||
# %TSI% = Tactical Short Information (I-IV)
|
||||
# %DESCR% = Description, if description-module is used
|
||||
# %DATE% = Date (by script)
|
||||
# %TIME% = Time (by script)
|
||||
# %LPAR% = (
|
||||
# %RPAR% = )
|
||||
fms_message = %DATE% %TIME%: %FMS%
|
||||
|
||||
# %ZVEI% = ZVEI 5-tone Code
|
||||
# %DESCR% = Description, if description-module is used
|
||||
# %DATE% = Date (by script)
|
||||
# %TIME% = Time (by script)
|
||||
# %LPAR% = (
|
||||
# %RPAR% = )
|
||||
zvei_message = %DATE% %TIME%: %ZVEI%
|
||||
|
||||
# %RIC% = Pocsag RIC
|
||||
# %FUNC% = Pocsac function/Subric (1-4)
|
||||
# %FUNCCHAR% = Pocsac function/Subric als character (a-d)
|
||||
# %MSG% = Message of the Pocsag telegram
|
||||
# %BITRATE% = Bitrate of the Pocsag telegram
|
||||
# %DESCR% = Description, if description-module is used
|
||||
# %DATE% = Date (by script)
|
||||
# %TIME% = Time (by script)
|
||||
# %LPAR% = (
|
||||
# %RPAR% = )
|
||||
poc_message = %MSG%
|
||||
|
||||
|
||||
#####################
|
||||
##### Not ready yet #
|
||||
|
|
|
|||
66
plugins/yowsup/yowsup.py
Normal file
66
plugins/yowsup/yowsup.py
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
#!/usr/bin/python
|
||||
# -*- coding: cp1252 -*-
|
||||
|
||||
"""
|
||||
Yowsup-Plugin to dispatch POCSAG - messages to WhatsApp Numbers or Chats
|
||||
|
||||
@author: fwmarcel
|
||||
|
||||
@requires: yowsup2 has to be installed
|
||||
whatsapp number and password
|
||||
yowsup-Configuration has to be set in the config.ini
|
||||
"""
|
||||
|
||||
import logging
|
||||
import subprocess
|
||||
import shlex
|
||||
import os
|
||||
|
||||
from includes import globalVars
|
||||
|
||||
from includes.helper import timeHandler
|
||||
from includes.helper import wildcardHandler
|
||||
from includes.helper import configHandler
|
||||
|
||||
|
||||
def onLoad():
|
||||
return
|
||||
|
||||
def run(typ,freq,data):
|
||||
try:
|
||||
if configHandler.checkConfig("yowsup"):
|
||||
|
||||
empfaenger = globalVars.config.get("yowsup", "empfaenger")
|
||||
sender = globalVars.config.get("yowsup", "sender")
|
||||
password = globalVars.config.get("yowsup", "password")
|
||||
devnull = open(os.devnull, "wb")
|
||||
|
||||
if typ == "FMS":
|
||||
text = globalVars.config.get("yowsup","fms_message")
|
||||
text = wildcardHandler.replaceWildcards(text, data)
|
||||
cmd = 'yowsup-cli demos -l ' + sender + ':' + password + ' -s ' + empfaenger + ' "' + text + '" -M'
|
||||
subprocess.call(shlex.split(cmd), stdout=devnull, stderr=devnull)
|
||||
logging.debug("Message has been sent")
|
||||
elif typ == "ZVEI":
|
||||
text = globalVars.config.get("yowsup","zvei_message")
|
||||
text = wildcardHandler.replaceWildcards(text, data)
|
||||
cmd = 'yowsup-cli demos -l ' + sender + ':' + password + ' -s ' + empfaenger + ' "' + text + '" -M'
|
||||
subprocess.call(shlex.split(cmd), stdout=devnull, stderr=devnull)
|
||||
logging.debug("Message has been sent")
|
||||
elif typ == "POC":
|
||||
try:
|
||||
text = globalVars.config.get("yowsup","poc_message")
|
||||
text = wildcardHandler.replaceWildcards(text, data)
|
||||
cmd = 'yowsup-cli demos -l ' + sender + ':' + password + ' -s ' + empfaenger + ' "' + text + '" -M'
|
||||
subprocess.call(shlex.split(cmd), stdout=devnull, stderr=devnull)
|
||||
logging.debug("Message has been sent")
|
||||
except:
|
||||
logging.error("Message not send")
|
||||
logging.debug("Message not send")
|
||||
return
|
||||
else:
|
||||
logging.warning("Invalid Typ: %s", typ)
|
||||
|
||||
except:
|
||||
logging.error("unknown error")
|
||||
logging.debug("unknown error", exc_info=True)
|
||||
Loading…
Reference in a new issue