diff --git a/CHANGELOG.md b/CHANGELOG.md index d10eb56..b72530e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +### __[v2.5.1]__ - 28.04.2020 +##### Added +- Plugin requirements: Added requirements.txt for all plugins requiring extra python packages so the install will be easier [#446](https://github.com/Schrolli91/BOSWatch/pull/446) +- DescriptionList POC: add new description parameter for Sub-RICs without a main RIC definition. parameter 'onlysubric'. [#449](https://github.com/Schrolli91/BOSWatch/pull/449) +##### Fixed +- MySQL plugin: Ensure character set (utf8mb4) and collation (utf8mb4_general_ci) are set correctly when connection to database is established. [#447](https://github.com/Schrolli91/BOSWatch/pull/447) +- E-Mail plugin: Create MIME-compliant header that can contain any kind of string. [#448](https://github.com/Schrolli91/BOSWatch/pull/448) + + ### __[v2.5]__ - 16.04.2020 ##### Added - Divera-Plugin: Plugin zum Ansteuern der Divera-Api. [#415](https://github.com/Schrolli91/BOSWatch/pull/415) diff --git a/config/config.template.ini b/config/config.template.ini index 358fd18..af5da01 100644 --- a/config/config.template.ini +++ b/config/config.template.ini @@ -103,6 +103,11 @@ filter_range_end = 9999999 # descriptions are loaded from csv/poc.csv idDescribed = 0 +# change between Main-RIC with Sub-RIC (0 - off) +# or only the Sub-RIC (1 - on) +# descriptions are loaded from csv/poc.csv +onlysubric = 0 + # Static Massages for Subrics. rica = Feuer ricb = TH diff --git a/csv/poc.template.csv b/csv/poc.template.csv index 9dfe7d4..8cba8c2 100644 --- a/csv/poc.template.csv +++ b/csv/poc.template.csv @@ -5,12 +5,18 @@ ric,description # For each RIC-Address you could set a description-text # Use the structure: ric,"Description-Text" # +# main RIC with subric: # You can even define specific subrics, therefore you # 1. need to specify a main RIC: 1234567, "Unit One" # 2. specify a certain subric: 1234567B, "Subunit Bravo" # The result for 1234567B will be "Unit One Subunit Bravo" # - Be sure having defined the main RIC (step one)! - # +# Only subric: +# Specify only the subric: 123457B, "Subunit Bravo" +# The result for 1234567B will be "Subunit Bravo" +# - main RIC is not required - +# # !!! DO NOT delete the first line !!! # 1234567,"POCSAG testdata äöüß" diff --git a/includes/descriptionList.py b/includes/descriptionList.py index 11281fd..b8d528b 100644 --- a/includes/descriptionList.py +++ b/includes/descriptionList.py @@ -110,8 +110,11 @@ def getDescription(typ, data): elif typ == "ZVEI": resultStr = zveiDescribtionList[data] elif typ == "POC": - resultStr = ricDescribtionList[data[:-1]] # MainRIC - resultStr += " " + ricDescribtionList[data] # SubRIC + if globalVars.config.getint("POC", "onlysubric"): + resultStr = ricDescribtionList[data] # only SubRIC + else: + resultStr = ricDescribtionList[data[:-1]] # MainRIC + resultStr += " " + ricDescribtionList[data] # SubRIC else: logging.warning("Invalid Typ: %s", typ) diff --git a/includes/globalVars.py b/includes/globalVars.py index 2133748..05a1808 100644 --- a/includes/globalVars.py +++ b/includes/globalVars.py @@ -9,9 +9,9 @@ Global variables """ # version info -versionNr = "2.5" +versionNr = "2.5.1" branch = "master" -buildDate = "16.04.2020" +buildDate = "28.04.2020" # Global variables config = 0 diff --git a/plugins/MySQL/MySQL.py b/plugins/MySQL/MySQL.py index 04a8d08..8520381 100644 --- a/plugins/MySQL/MySQL.py +++ b/plugins/MySQL/MySQL.py @@ -91,7 +91,7 @@ def run(typ,freq,data): # Connect to MySQL # logging.debug("connect to MySQL") - connection = mysql.connector.connect(host = globalVars.config.get("MySQL","dbserver"), port = globalVars.config.get("MySQL","dbport"), user = globalVars.config.get("MySQL","dbuser"), passwd = globalVars.config.get("MySQL","dbpassword"), db = globalVars.config.get("MySQL","database"), charset='utf8mb4') + connection = mysql.connector.connect(host = globalVars.config.get("MySQL","dbserver"), port = globalVars.config.get("MySQL","dbport"), user = globalVars.config.get("MySQL","dbuser"), passwd = globalVars.config.get("MySQL","dbpassword"), db = globalVars.config.get("MySQL","database"), charset = 'utf8mb4', collation = 'utf8mb4_general_ci') cursor = connection.cursor() except: logging.error("cannot connect to MySQL") diff --git a/plugins/README.md b/plugins/README.md index 093e510..be512ad 100644 --- a/plugins/README.md +++ b/plugins/README.md @@ -16,6 +16,16 @@ This `.run()` routine is called every time an alarm comes in Here are the information from BOSWatch available. See section `5. Process the data from BOSWatch` +#### 1.4 Requirements +Add all required (which need to be installed separately) python packages to a requirements.txt in the plugin directory so that the user can simply install all requirements for this plugin. + +For examples look at [the Telegram plugin](Telegram/requirements.txt) + +##### 1.4.1 Requirement installation +To install the packages from the requirements.txt run +`pip install -r /path/to/plugin/directory/requirements.txt` +Or because for the current version (2.5) Python2 is required +`pip2 install -r /path/to/plungin/directory/requirements.txt` will work for sure ## 2. Use Global Logging #### 2.1 Init and Use diff --git a/plugins/Telegram/requirements.txt b/plugins/Telegram/requirements.txt new file mode 100644 index 0000000..63667ac --- /dev/null +++ b/plugins/Telegram/requirements.txt @@ -0,0 +1,2 @@ +python-telegram-bot +requests diff --git a/plugins/eMail/eMail.py b/plugins/eMail/eMail.py index ec271b2..b8b5ea0 100644 --- a/plugins/eMail/eMail.py +++ b/plugins/eMail/eMail.py @@ -13,6 +13,7 @@ import logging # Global logger import smtplib #for the SMTP client from email.mime.text import MIMEText # Import the email modules we'll need +from email.header import Header # Import the email modules we'll need from email.utils import formatdate # need for confirm to RFC2822 standard from email.utils import make_msgid # need for confirm to RFC2822 standard @@ -61,7 +62,7 @@ def doSendmail(server, subject, mailtext): msg = MIMEText(mailtext, 'plain', 'UTF-8') msg['From'] = globalVars.config.get("eMail", "from") msg['To'] = globalVars.config.get("eMail", "to") - msg['Subject'] = subject + msg['Subject'] = Header(subject, 'UTF-8') msg['Date'] = formatdate() msg['Message-Id'] = make_msgid() msg['Priority'] = globalVars.config.get("eMail", "priority") diff --git a/plugins/yowsup/requirements.txt b/plugins/yowsup/requirements.txt new file mode 100644 index 0000000..372676b --- /dev/null +++ b/plugins/yowsup/requirements.txt @@ -0,0 +1 @@ +yowsup2