From 6bbffb111d7182c8be5f56e864a4d36f0195278a Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Tue, 23 Oct 2018 08:10:28 +0200 Subject: [PATCH 01/11] fix false date in changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e1532d3..6734c9b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,7 @@ ##### Security -### __[v2.4.1]__ - 23.20.2018 +### __[v2.4.1]__ - 23.10.2018 ##### Added - Pushover-Plugin: Priorität für einzelne RIC und ZVEI in config einstellbar [#378](https://github.com/Schrolli91/BOSWatch/pull/378) ##### Changed From 97e00d239cf0b2ecb3adc2f7e97b2832472ade85 Mon Sep 17 00:00:00 2001 From: PeterLaemmle Date: Sun, 28 Oct 2018 17:51:13 +0100 Subject: [PATCH 02/11] Update Telegram.py -Add routing per overlay in overview map -Switch to SSL communication --- plugins/Telegram/Telegram.py | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/plugins/Telegram/Telegram.py b/plugins/Telegram/Telegram.py index 451fe54..4c9ac1d 100644 --- a/plugins/Telegram/Telegram.py +++ b/plugins/Telegram/Telegram.py @@ -4,7 +4,7 @@ """ Plugin to send FMS-, ZVEI- and POCSAG-messages via Telegram @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 includes import globalVars # Global variables if globalVars.config.get("Telegram","RICforLocationAPIKey"): - import urllib, googlemaps + import requests, json # Helper function, uncomment to use from includes.helper import wildcardHandler @@ -98,12 +98,19 @@ def run(typ,freq,data): # Generate map logging.debug("Extract address from POCSAG message") address = "+".join(data["msg"].split(')')[0].split('/',1)[1].replace('(',' ').split()) + # Origin for routing, use format 'City+Street+Number' + origin = "CityOfDeparture+Street+Number" + logging.debug("Retrieve polylines from Directions API") + url = "".join(["https://maps.googleapis.com/maps/api/directions/json?origin=", origin, "&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']) + 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]) - urllib.urlretrieve(url, "overview_map.png") - url = "".join(["http://maps.googleapis.com/maps/api/staticmap?markers=", address, "&size=240x320&scale=2&maptype=hybrid&zoom=17&language=de&key=", GoogleAPIKey]) - urllib.urlretrieve(url, "detail_map.png") + url = "".join(["https://maps.googleapis.com/maps/api/staticmap?&size=480x640&maptype=roadmap&language=de&path=enc:", response['routes'][0]['overview_polyline']['points'], "&key=", GoogleAPIKey]) + with open("overview_map.png", "wb") as img: img.write(requests.get(url).content) + 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 logging.debug("Send message and maps via Telegram BOT") @@ -112,10 +119,11 @@ def run(typ,freq,data): # Geocoding of address logging.debug("Geocode address") - gcode = googlemaps.Client(key='%s' % GoogleAPIKey) - gcode_result = gcode.geocode(address) + url = "".join(["https://maps.googleapis.com/maps/api/geocode/json?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") - 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: logging.warning("Invalid Typ: %s", typ) except Unauthorized: From f35ca756883ab83547491feca8e590c4aeb7e83a Mon Sep 17 00:00:00 2001 From: PeterLaemmle Date: Sun, 28 Oct 2018 20:48:52 +0100 Subject: [PATCH 03/11] Update Telegram.py --- plugins/Telegram/Telegram.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/plugins/Telegram/Telegram.py b/plugins/Telegram/Telegram.py index 4c9ac1d..8f27ec7 100644 --- a/plugins/Telegram/Telegram.py +++ b/plugins/Telegram/Telegram.py @@ -107,9 +107,11 @@ def run(typ,freq,data): logging.debug("Directions API return status: %s" % response['status']) logging.debug("Retrieve maps from Google") - url = "".join(["https://maps.googleapis.com/maps/api/staticmap?&size=480x640&maptype=roadmap&language=de&path=enc:", response['routes'][0]['overview_polyline']['points'], "&key=", GoogleAPIKey]) + url = "".join(["https://maps.googleapis.com/maps/api/staticmap?&size=480x640&maptype=roadmap&language=de&path=enc:", + response['routes'][0]['overview_polyline']['points'], "&key=", GoogleAPIKey]) with open("overview_map.png", "wb") as img: img.write(requests.get(url).content) - url = "".join(["https://maps.googleapis.com/maps/api/staticmap?markers=", address, "&size=240x320&scale=2&maptype=hybrid&zoom=17&language=de&key=", GoogleAPIKey]) + 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 @@ -119,11 +121,15 @@ def run(typ,freq,data): # Geocoding of address logging.debug("Geocode address") - url = "".join(["https://maps.googleapis.com/maps/api/geocode/json?address=", address, "&language=de&key=", GoogleAPIKey]) + url = "".join(["https://maps.googleapis.com/maps/api/geocode/json?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") - bot.sendLocation('%s' % BOTChatIDAPIKey, gcode_result[results][0]['geometry']['location']['lat'], gcode_result[results][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: logging.warning("Invalid Typ: %s", typ) except Unauthorized: From 6fa93f2f99245983c830551f93bc252fb6b9a7d1 Mon Sep 17 00:00:00 2001 From: PeterLaemmle Date: Sun, 28 Oct 2018 21:03:57 +0100 Subject: [PATCH 04/11] Update Telegram.py --- plugins/Telegram/Telegram.py | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/Telegram/Telegram.py b/plugins/Telegram/Telegram.py index 8f27ec7..ecd5445 100644 --- a/plugins/Telegram/Telegram.py +++ b/plugins/Telegram/Telegram.py @@ -101,6 +101,7 @@ def run(typ,freq,data): # Origin for routing, use format 'City+Street+Number' origin = "CityOfDeparture+Street+Number" + # Retrieve directions using Google API logging.debug("Retrieve polylines from Directions API") url = "".join(["https://maps.googleapis.com/maps/api/directions/json?origin=", origin, "&destination=", address, "&mode=driving&key=", GoogleAPIKey]) response = json.loads(requests.get(url).content.decode('utf-8')) From 7605a142292d81987f74bd7a3b898f3501c19bac Mon Sep 17 00:00:00 2001 From: PeterLaemmle Date: Sun, 28 Oct 2018 21:24:49 +0100 Subject: [PATCH 05/11] Update config.template.ini Allow definition of routing origin in configuration file --- config/config.template.ini | 3 +++ 1 file changed, 3 insertions(+) diff --git a/config/config.template.ini b/config/config.template.ini index bda5904..e2800ed 100644 --- a/config/config.template.ini +++ b/config/config.template.ini @@ -403,6 +403,9 @@ RICforLocationAPIKey = # This is your Google API key. # Required if you want to create a map based on location information received with the above RIC. 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! FMS_message = %DATE% %TIME%: %FMS% From 5681d33832560251d8244c50707bad0397784283 Mon Sep 17 00:00:00 2001 From: PeterLaemmle Date: Sun, 28 Oct 2018 21:30:41 +0100 Subject: [PATCH 06/11] Update Telegram.py Allow definition of routing origin in configuration file --- plugins/Telegram/Telegram.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/plugins/Telegram/Telegram.py b/plugins/Telegram/Telegram.py index ecd5445..05f9887 100644 --- a/plugins/Telegram/Telegram.py +++ b/plugins/Telegram/Telegram.py @@ -26,6 +26,7 @@ BOTTokenAPIKey = None BOTChatIDAPIKey = None RICforLocationAPIKey = None GoogleAPIKey = None +RoutingOrigin = None ## # @@ -43,12 +44,14 @@ def onLoad(): global BOTChatIDAPIKey global RICforLocationAPIKey global GoogleAPIKey + global RoutingOrigin configHandler.checkConfig("Telegram") BOTTokenAPIKey = globalVars.config.get("Telegram","BOTTokenAPIKey") BOTChatIDAPIKey = globalVars.config.get("Telegram","BOTChatIDAPIKey") RICforLocationAPIKey = globalVars.config.get("Telegram","RICforLocationAPIKey") GoogleAPIKey = globalVars.config.get("Telegram","GoogleAPIKey") + RoutingOrigin = globalVars.config.get("Telegram","RoutingOrigin") return @@ -98,12 +101,10 @@ def run(typ,freq,data): # Generate map logging.debug("Extract address from POCSAG message") address = "+".join(data["msg"].split(')')[0].split('/',1)[1].replace('(',' ').split()) - # Origin for routing, use format 'City+Street+Number' - origin = "CityOfDeparture+Street+Number" - # Retrieve directions using Google API logging.debug("Retrieve polylines from Directions API") - url = "".join(["https://maps.googleapis.com/maps/api/directions/json?origin=", origin, "&destination=", address, "&mode=driving&key=", GoogleAPIKey]) + 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']) From 53efd1467a44bb4208a02eb7d9b7f2f58d772154 Mon Sep 17 00:00:00 2001 From: PeterLaemmle Date: Mon, 29 Oct 2018 16:19:12 +0100 Subject: [PATCH 07/11] Update Telegram.py Pleasing the Codacy BOT ;-) --- plugins/Telegram/Telegram.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/Telegram/Telegram.py b/plugins/Telegram/Telegram.py index 05f9887..2120d75 100644 --- a/plugins/Telegram/Telegram.py +++ b/plugins/Telegram/Telegram.py @@ -107,10 +107,10 @@ def run(typ,freq,data): 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") - url = "".join(["https://maps.googleapis.com/maps/api/staticmap?&size=480x640&maptype=roadmap&language=de&path=enc:", - response['routes'][0]['overview_polyline']['points'], "&key=", GoogleAPIKey]) + url = "".join(["https://maps.googleapis.com/maps/api/staticmap?&size=480x640&maptype=roadmap&path=enc:", + response['routes'][0]['overview_polyline']['points'], "&language=de&key=", GoogleAPIKey]) with open("overview_map.png", "wb") as img: img.write(requests.get(url).content) url = "".join(["https://maps.googleapis.com/maps/api/staticmap?markers=", address, "&size=240x320&scale=2&maptype=hybrid&zoom=17&language=de&key=", GoogleAPIKey]) From 5692cebdcbb7beda99db4647913242cc8b0234ae Mon Sep 17 00:00:00 2001 From: PeterLaemmle Date: Tue, 30 Oct 2018 20:00:33 +0100 Subject: [PATCH 08/11] Update CHANGELOG.md --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6734c9b..852ef54 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,9 @@ ### __[v#.#]__ - date ##### 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) ##### Deprecated ##### Removed ##### Fixed From a1a96e7d7d6c16775c16968626e20d8e2fd43d3d Mon Sep 17 00:00:00 2001 From: dk5ra Date: Thu, 1 Nov 2018 13:20:28 +0100 Subject: [PATCH 09/11] Update install_service.sh --- service/install_service.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/service/install_service.sh b/service/install_service.sh index 2789a35..d97dc40 100644 --- a/service/install_service.sh +++ b/service/install_service.sh @@ -45,6 +45,7 @@ elif [ "$action" == "r" ]; then # we want to remove the service # and remove it rm /etc/systemd/system/boswatch.service + echo "BosWatch service removed" else # error handling echo "Invalid input - please try again" exit 1 From d7b43ca8082f7b568315a66dac24a25b8f4c05bc Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Mon, 11 Mar 2019 12:38:43 +0100 Subject: [PATCH 10/11] edit readme --- README.md | 41 +++++++++++++++++++---------------------- includes/globalVars.py | 2 +- 2 files changed, 20 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index 19a918d..4f4ed23 100644 --- a/README.md +++ b/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|[![Codacy Badge](https://img.shields.io/codacy/grade/d512976554354a199555bd34ed179bb1/master.svg)](https://www.codacy.com/app/Schrolli91/BOSWatch/dashboard?bid=3763821)|[![Build Status](https://travis-ci.org/Schrolli91/BOSWatch.svg?branch=master)](https://travis-ci.org/Schrolli91/BOSWatch)| -|develop|[![Codacy Badge](https://img.shields.io/codacy/grade/d512976554354a199555bd34ed179bb1/develop.svg)](https://www.codacy.com/app/Schrolli91/BOSWatch/dashboard?bid=3763820)|[![Build Status](https://travis-ci.org/Schrolli91/BOSWatch.svg?branch=develop)](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! - ![# BOSWatch](/boswatch.png) :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. +### Fast support on https://bwcc.boswatch.de (Mattermost) +##### Work on BOSWatch 3 has started + +|Branch|Code Qualität|CI-Build| +|---|---|---| +|master|[![Codacy Badge](https://img.shields.io/codacy/grade/d512976554354a199555bd34ed179bb1/master.svg)](https://www.codacy.com/app/Schrolli91/BOSWatch/dashboard?bid=3763821)|[![Build Status](https://travis-ci.org/Schrolli91/BOSWatch.svg?branch=master)](https://travis-ci.org/Schrolli91/BOSWatch)| +|develop|[![Codacy Badge](https://img.shields.io/codacy/grade/d512976554354a199555bd34ed179bb1/develop.svg)](https://www.codacy.com/app/Schrolli91/BOSWatch/dashboard?bid=3763820)|[![Build Status](https://travis-ci.org/Schrolli91/BOSWatch.svg?branch=develop)](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!** 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]` 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 `;`) - `TYP` = the data typ (FMS|ZVEI|POC) diff --git a/includes/globalVars.py b/includes/globalVars.py index 0446808..768e3c9 100644 --- a/includes/globalVars.py +++ b/includes/globalVars.py @@ -9,7 +9,7 @@ Global variables """ # version info -versionNr = "2.4.1" +versionNr = "2.4.2" branch = "dev" buildDate = "unreleased" From 9a3d4ec12ba7ffbcd5d342bf632dc8587ae17ce8 Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Mon, 11 Mar 2019 12:40:39 +0100 Subject: [PATCH 11/11] prepare release --- CHANGELOG.md | 10 +++++++--- includes/globalVars.py | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 852ef54..61b9383 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,17 +1,21 @@ # Changelog - ### __[v#.#]__ - date ##### 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) ##### Deprecated ##### Removed ##### Fixed ##### Security +### __[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.10.2018 ##### Added - Pushover-Plugin: Priorität für einzelne RIC und ZVEI in config einstellbar [#378](https://github.com/Schrolli91/BOSWatch/pull/378) diff --git a/includes/globalVars.py b/includes/globalVars.py index 768e3c9..25962e3 100644 --- a/includes/globalVars.py +++ b/includes/globalVars.py @@ -9,7 +9,7 @@ Global variables """ # version info -versionNr = "2.4.2" +versionNr = "2.4.3" branch = "dev" buildDate = "unreleased"