mirror of
https://github.com/Schrolli91/BOSWatch.git
synced 2025-12-06 07:42:03 +01:00
Merge branch 'develop'
This commit is contained in:
commit
65dd9b495d
|
|
@ -1,8 +1,14 @@
|
||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
|
||||||
|
### __[v2.4.2]__ - 11.03.2019
|
||||||
|
##### Added
|
||||||
|
- Telegram-Plugin: In der generierten Übersichtkarte wird eine Anfahrtsroute integriert. Der Abfahrtsort ist konfiguierbar. [#382](https://github.com/Schrolli91/BOSWatch/pull/382)
|
||||||
|
##### Changed
|
||||||
|
- Telegram-Plugin: Aufrufe der Google API erfolgen per SSL und ohne zusätzliche Bibliotheken [#382](https://github.com/Schrolli91/BOSWatch/pull/382)
|
||||||
|
|
||||||
### __[v2.4.1]__ - 23.20.2018
|
|
||||||
|
### __[v2.4.1]__ - 23.10.2018
|
||||||
##### Added
|
##### Added
|
||||||
- Pushover-Plugin: Priorität für einzelne RIC und ZVEI in config einstellbar [#378](https://github.com/Schrolli91/BOSWatch/pull/378)
|
- Pushover-Plugin: Priorität für einzelne RIC und ZVEI in config einstellbar [#378](https://github.com/Schrolli91/BOSWatch/pull/378)
|
||||||
##### Changed
|
##### Changed
|
||||||
|
|
|
||||||
41
README.md
41
README.md
|
|
@ -1,24 +1,3 @@
|
||||||
### Fast support on https://bwcc.boswatch.de (Mattermost-Server)
|
|
||||||
#### Forum: https://boswatch.de
|
|
||||||
|
|
||||||
### Arbeiten an BOSWatch 3 gestartet
|
|
||||||
#### Work on BOSWatch 3 has started
|
|
||||||
## see: https://boswatch.de/index.php?thread/29-boswatch-3/
|
|
||||||
|
|
||||||
|
|
||||||
|Branch|Code Qualität|CI-Build|
|
|
||||||
|---|---|---|
|
|
||||||
|master|[](https://www.codacy.com/app/Schrolli91/BOSWatch/dashboard?bid=3763821)|[](https://travis-ci.org/Schrolli91/BOSWatch)|
|
|
||||||
|develop|[](https://www.codacy.com/app/Schrolli91/BOSWatch/dashboard?bid=3763820)|[](https://travis-ci.org/Schrolli91/BOSWatch)|
|
|
||||||
|
|
||||||
|
|
||||||
**Unterstützung gesucht**
|
|
||||||
|
|
||||||
Zur Weiterentwicklung des Programms benötigen wir Deine Mithilfe - bitte melde dich per Issue, wenn du Anwender in einem verschlüsselten POCSAG-Netz und im (legalen) Besitz des dazugehörigen Schlüssels bist.
|
|
||||||
In der Zukunft wollen wir die Möglichkeit schaffen, codierte Nachrichten zu entschlüsseln (und nur dann, wenn der Schlüssel bekannt ist!), dafür brauchen wir Dich als Tester!
|
|
||||||
|
|
||||||
**Readme ist veraltet** - bitte im [Wiki](https://github.com/Schrolli91/BOSWatch/wiki) nachschauen!
|
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
:satellite: Python Script to receive and decode German BOS Information with rtl_fm and multimon-NG :satellite:
|
:satellite: Python Script to receive and decode German BOS Information with rtl_fm and multimon-NG :satellite:
|
||||||
|
|
@ -32,6 +11,24 @@ The intercept of the German BOS radio is **strictly prohibited** and will be pro
|
||||||
The software was developed using the Multimon-NG code, a function in the real operation can not be guaranteed.
|
The software was developed using the Multimon-NG code, a function in the real operation can not be guaranteed.
|
||||||
|
|
||||||
|
|
||||||
|
### Fast support on https://bwcc.boswatch.de (Mattermost)
|
||||||
|
##### Work on BOSWatch 3 has started
|
||||||
|
|
||||||
|
|Branch|Code Qualität|CI-Build|
|
||||||
|
|---|---|---|
|
||||||
|
|master|[](https://www.codacy.com/app/Schrolli91/BOSWatch/dashboard?bid=3763821)|[](https://travis-ci.org/Schrolli91/BOSWatch)|
|
||||||
|
|develop|[](https://www.codacy.com/app/Schrolli91/BOSWatch/dashboard?bid=3763820)|[](https://travis-ci.org/Schrolli91/BOSWatch)|
|
||||||
|
|
||||||
|
|
||||||
|
**Unterstützung gesucht**
|
||||||
|
|
||||||
|
Zur Weiterentwicklung des Programms benötigen wir Deine Mithilfe - bitte melde dich per Issue, wenn du Anwender in einem verschlüsselten POCSAG-Netz und im **legalen** Besitz des dazugehörigen Schlüssels bist.
|
||||||
|
In der Zukunft wollen wir die Möglichkeit schaffen, codierte Nachrichten zu entschlüsseln (und nur dann, wenn der Schlüssel bekannt ist!), dafür brauchen wir Dich als Tester!
|
||||||
|
|
||||||
|
**Readme ist veraltet** - bitte im [Wiki](https://github.com/Schrolli91/BOSWatch/wiki) nachschauen!
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
**Please** only use Code from **master**-Branch - thats **the only stable!**
|
**Please** only use Code from **master**-Branch - thats **the only stable!**
|
||||||
|
|
||||||
beta-branch is for beta-test of new features
|
beta-branch is for beta-test of new features
|
||||||
|
|
@ -78,7 +75,7 @@ For the other functions see "Usage" below.
|
||||||
For the RegEX filter functions see Section `[Filters]`
|
For the RegEX filter functions see Section `[Filters]`
|
||||||
http://www.regexr.com/ - RegEX test tool an documentation
|
http://www.regexr.com/ - RegEX test tool an documentation
|
||||||
|
|
||||||
If RegEX is enabled - only alloewd data will pass !
|
If RegEX is enabled - only allowed data will pass !
|
||||||
|
|
||||||
Syntax: `INDIVIDUAL_NAME = TYP;DATAFIELD;PLUGIN;FREQUENZ;REGEX` (separator `;`)
|
Syntax: `INDIVIDUAL_NAME = TYP;DATAFIELD;PLUGIN;FREQUENZ;REGEX` (separator `;`)
|
||||||
- `TYP` = the data typ (FMS|ZVEI|POC)
|
- `TYP` = the data typ (FMS|ZVEI|POC)
|
||||||
|
|
|
||||||
|
|
@ -403,6 +403,9 @@ RICforLocationAPIKey =
|
||||||
# This is your Google API key.
|
# This is your Google API key.
|
||||||
# Required if you want to create a map based on location information received with the above RIC.
|
# Required if you want to create a map based on location information received with the above RIC.
|
||||||
GoogleAPIKey =
|
GoogleAPIKey =
|
||||||
|
# Define your start address for the routing
|
||||||
|
# Use the following format: CityOfOrigin+Street+Number
|
||||||
|
RoutingOrigin = MyCity+MyStreet+MyNumber
|
||||||
|
|
||||||
#Wildcards can be used, see end of the file!
|
#Wildcards can be used, see end of the file!
|
||||||
FMS_message = %DATE% %TIME%: %FMS%
|
FMS_message = %DATE% %TIME%: %FMS%
|
||||||
|
|
|
||||||
|
|
@ -9,9 +9,9 @@ Global variables
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# version info
|
# version info
|
||||||
versionNr = "2.4.1"
|
versionNr = "2.4.2"
|
||||||
branch = "master"
|
branch = "master"
|
||||||
buildDate = "23.10.2018"
|
buildDate = "11.03.2019"
|
||||||
|
|
||||||
# Global variables
|
# Global variables
|
||||||
config = 0
|
config = 0
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
"""
|
"""
|
||||||
Plugin to send FMS-, ZVEI- and POCSAG-messages via Telegram
|
Plugin to send FMS-, ZVEI- and POCSAG-messages via Telegram
|
||||||
@author: Peter Laemmle
|
@author: Peter Laemmle
|
||||||
@requires: Telegram BOT token, Telegram chat ID, library python-telegram-bot and optional googlemaps
|
@requires: Telegram BOT token, Telegram chat ID, library python-telegram-bot and optional requests and json
|
||||||
"""
|
"""
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
@ -15,7 +15,7 @@ import telegram
|
||||||
from telegram.error import (TelegramError, Unauthorized, BadRequest, NetworkError)
|
from telegram.error import (TelegramError, Unauthorized, BadRequest, NetworkError)
|
||||||
from includes import globalVars # Global variables
|
from includes import globalVars # Global variables
|
||||||
if globalVars.config.get("Telegram","RICforLocationAPIKey"):
|
if globalVars.config.get("Telegram","RICforLocationAPIKey"):
|
||||||
import urllib, googlemaps
|
import requests, json
|
||||||
|
|
||||||
# Helper function, uncomment to use
|
# Helper function, uncomment to use
|
||||||
from includes.helper import wildcardHandler
|
from includes.helper import wildcardHandler
|
||||||
|
|
@ -26,6 +26,7 @@ BOTTokenAPIKey = None
|
||||||
BOTChatIDAPIKey = None
|
BOTChatIDAPIKey = None
|
||||||
RICforLocationAPIKey = None
|
RICforLocationAPIKey = None
|
||||||
GoogleAPIKey = None
|
GoogleAPIKey = None
|
||||||
|
RoutingOrigin = None
|
||||||
|
|
||||||
##
|
##
|
||||||
#
|
#
|
||||||
|
|
@ -43,12 +44,14 @@ def onLoad():
|
||||||
global BOTChatIDAPIKey
|
global BOTChatIDAPIKey
|
||||||
global RICforLocationAPIKey
|
global RICforLocationAPIKey
|
||||||
global GoogleAPIKey
|
global GoogleAPIKey
|
||||||
|
global RoutingOrigin
|
||||||
|
|
||||||
configHandler.checkConfig("Telegram")
|
configHandler.checkConfig("Telegram")
|
||||||
BOTTokenAPIKey = globalVars.config.get("Telegram","BOTTokenAPIKey")
|
BOTTokenAPIKey = globalVars.config.get("Telegram","BOTTokenAPIKey")
|
||||||
BOTChatIDAPIKey = globalVars.config.get("Telegram","BOTChatIDAPIKey")
|
BOTChatIDAPIKey = globalVars.config.get("Telegram","BOTChatIDAPIKey")
|
||||||
RICforLocationAPIKey = globalVars.config.get("Telegram","RICforLocationAPIKey")
|
RICforLocationAPIKey = globalVars.config.get("Telegram","RICforLocationAPIKey")
|
||||||
GoogleAPIKey = globalVars.config.get("Telegram","GoogleAPIKey")
|
GoogleAPIKey = globalVars.config.get("Telegram","GoogleAPIKey")
|
||||||
|
RoutingOrigin = globalVars.config.get("Telegram","RoutingOrigin")
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
@ -98,12 +101,20 @@ def run(typ,freq,data):
|
||||||
# Generate map
|
# Generate map
|
||||||
logging.debug("Extract address from POCSAG message")
|
logging.debug("Extract address from POCSAG message")
|
||||||
address = "+".join(data["msg"].split(')')[0].split('/',1)[1].replace('(',' ').split())
|
address = "+".join(data["msg"].split(')')[0].split('/',1)[1].replace('(',' ').split())
|
||||||
|
# Retrieve directions using Google API
|
||||||
|
logging.debug("Retrieve polylines from Directions API")
|
||||||
|
url = "".join(["https://maps.googleapis.com/maps/api/directions/json?origin=",
|
||||||
|
RoutingOrigin, "&destination=", address, "&mode=driving&key=", GoogleAPIKey])
|
||||||
|
response = json.loads(requests.get(url).content.decode('utf-8'))
|
||||||
|
logging.debug("Directions API return status: %s" % response['status'])
|
||||||
|
# Retrieve static maps using Google API
|
||||||
logging.debug("Retrieve maps from Google")
|
logging.debug("Retrieve maps from Google")
|
||||||
url = "".join(["http://maps.googleapis.com/maps/api/staticmap?markers=", address, "&size=480x640&maptype=roadmap&zoom=16&language=de&key=", GoogleAPIKey])
|
url = "".join(["https://maps.googleapis.com/maps/api/staticmap?&size=480x640&maptype=roadmap&path=enc:",
|
||||||
urllib.urlretrieve(url, "overview_map.png")
|
response['routes'][0]['overview_polyline']['points'], "&language=de&key=", GoogleAPIKey])
|
||||||
url = "".join(["http://maps.googleapis.com/maps/api/staticmap?markers=", address, "&size=240x320&scale=2&maptype=hybrid&zoom=17&language=de&key=", GoogleAPIKey])
|
with open("overview_map.png", "wb") as img: img.write(requests.get(url).content)
|
||||||
urllib.urlretrieve(url, "detail_map.png")
|
url = "".join(["https://maps.googleapis.com/maps/api/staticmap?markers=",
|
||||||
|
address, "&size=240x320&scale=2&maptype=hybrid&zoom=17&language=de&key=", GoogleAPIKey])
|
||||||
|
with open("detail_map.png", "wb") as img: img.write(requests.get(url).content)
|
||||||
|
|
||||||
# Send message and map with Telegram
|
# Send message and map with Telegram
|
||||||
logging.debug("Send message and maps via Telegram BOT")
|
logging.debug("Send message and maps via Telegram BOT")
|
||||||
|
|
@ -112,10 +123,15 @@ def run(typ,freq,data):
|
||||||
|
|
||||||
# Geocoding of address
|
# Geocoding of address
|
||||||
logging.debug("Geocode address")
|
logging.debug("Geocode address")
|
||||||
gcode = googlemaps.Client(key='%s' % GoogleAPIKey)
|
url = "".join(["https://maps.googleapis.com/maps/api/geocode/json?address=",
|
||||||
gcode_result = gcode.geocode(address)
|
address, "&language=de&key=", GoogleAPIKey])
|
||||||
|
gcode_result = json.loads(requests.get(url).content)
|
||||||
|
logging.debug("Geocoding API return status: %s" % gcode_result['status'])
|
||||||
logging.debug("Send location via Telegram BOT API")
|
logging.debug("Send location via Telegram BOT API")
|
||||||
bot.sendLocation('%s' % BOTChatIDAPIKey, gcode_result[0]['geometry']['location']['lat'], gcode_result[0]['geometry']['location']['lng'], disable_notification='true')
|
bot.sendLocation('%s' % BOTChatIDAPIKey,
|
||||||
|
gcode_result[results][0]['geometry']['location']['lat'],
|
||||||
|
gcode_result[results][0]['geometry']['location']['lng'],
|
||||||
|
disable_notification='true')
|
||||||
else:
|
else:
|
||||||
logging.warning("Invalid Typ: %s", typ)
|
logging.warning("Invalid Typ: %s", typ)
|
||||||
except Unauthorized:
|
except Unauthorized:
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,7 @@ elif [ "$action" == "r" ]; then # we want to remove the service
|
||||||
|
|
||||||
# and remove it
|
# and remove it
|
||||||
rm /etc/systemd/system/boswatch.service
|
rm /etc/systemd/system/boswatch.service
|
||||||
|
echo "BosWatch service removed"
|
||||||
else # error handling
|
else # error handling
|
||||||
echo "Invalid input - please try again"
|
echo "Invalid input - please try again"
|
||||||
exit 1
|
exit 1
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue