Prepare for release

pull/7/head
Mason10198 3 years ago
parent e7167c36ef
commit 430b1ddaf3

@ -1,7 +1,7 @@
#!/bin/bash
# CONTROL.sh
# A Control Script for SkywarnPlus
# A Control Script for SkywarnPlus v0.1.0
# by Mason Nelson (N5LSN/WRKF394)
#
#

@ -59,12 +59,14 @@ Follow the steps below to install:
```bash
apt update
apt upgrade
apt install git python3 python3-pip ffmpeg
apt install python3 python3-pip ffmpeg
pip3 install requests python-dateutil pydub
```
**Arch (HAMVOIP)**
It is a good idea to first update your HAMVOIP system using **Option 1** in the HAMVOIP menu before installing the dependencies.
```bash
pacman -S ffmpeg
wget https://bootstrap.pypa.io/pip/3.5/get-pip.py
@ -72,13 +74,15 @@ Follow the steps below to install:
pip install requests python-dateutil pydub
```
2. **Clone the Repository**
2. **Download SkywarnPlus**
Clone the SkywarnPlus repository from GitHub to the `/usr/local/bin` directory:
Download the latest release of SkywarnPlus from GitHub
```bash
cd /usr/local/bin
git clone https://github.com/mason10198/SkywarnPlus.git
wget https://github.com/Mason10198/SkywarnPlus/releases/latest/download/SkywarnPlus.zip
unzip SkywarnPlus.zip
rm SkywarnPlus.zip
```
3. **Configure CONTROL.sh Permissions**
@ -86,7 +90,8 @@ Follow the steps below to install:
The CONTROL.sh script must be made executable. Use the chmod command to change the file permissions:
```bash
sudo chmod +x /usr/local/bin/SkywarnPlus/CONTROL.sh
cd SkywarnPlus
chmod +x CONTROL.sh
```
4. **Edit Configuration**
@ -94,7 +99,7 @@ Follow the steps below to install:
Edit the [config.ini](config.ini) file according to your needs. This is where you will enter your NWS codes, enable/disable specific functions, etc.
```bash
sudo nano SkywarnPlus/config.ini
nano config.ini
```
You can find your area code(s) at https://alerts.weather.gov/. Select `County List` to the right of your state, and use the `County Code` associated with the area(s) you want SkywarnPlus to poll for WX alerts.

@ -1,7 +1,7 @@
#!/usr/bin/env python3
"""
SkywarnPlus by Mason Nelson (N5LSN/WRKF394)
SkywarnPlus v0.1.0 by Mason Nelson (N5LSN/WRKF394)
==================================================
SkywarnPlus is a utility that retrieves severe weather alerts from the National
Weather Service and integrates these alerts with an Asterisk/app_rpt based
@ -276,7 +276,13 @@ def getAlerts(countyCodes):
alerts (list): List of active weather alerts.
"""
# Severity mappings
severity_mapping_api = {"Extreme": 4, "Severe": 3, "Moderate": 2, "Minor": 1, "Unknown": 0}
severity_mapping_api = {
"Extreme": 4,
"Severe": 3,
"Moderate": 2,
"Minor": 1,
"Unknown": 0,
}
severity_mapping_words = {"Warning": 4, "Watch": 3, "Advisory": 2, "Statement": 1}
if config.getboolean("DEV", "INJECT", fallback=False):
@ -323,7 +329,9 @@ def getAlerts(countyCodes):
severity = severity_mapping_words.get(last_word, 0)
else:
severity = severity_mapping_api.get(severity, 0)
alerts.append((event, severity)) # Add event to list as a tuple
alerts.append(
(event, severity)
) # Add event to list as a tuple
else:
logger.error(
"Failed to retrieve alerts for {}, HTTP status code {}, response: {}".format(
@ -338,9 +346,9 @@ def getAlerts(countyCodes):
alerts.sort(
key=lambda x: (
x[1], # API-provided severity
severity_mapping_words.get(x[0].split()[-1], 0) # 'words' severity
severity_mapping_words.get(x[0].split()[-1], 0), # 'words' severity
),
reverse=True
reverse=True,
)
logger.debug("Sorted alerts: (alert), (severity)")
@ -348,7 +356,9 @@ def getAlerts(countyCodes):
logger.debug(alert)
# Only keep the events (not the severities)
alerts = [alert[0] for alert in alerts[:max_alerts]] # Only keep the first 'max_alerts' alerts
alerts = [
alert[0] for alert in alerts[:max_alerts]
] # Only keep the first 'max_alerts' alerts
return alerts
@ -372,7 +382,10 @@ def sayAlert(alerts):
for alert in alerts:
# Check if alert matches any pattern in the SayAlertBlockedEvents list
if any(fnmatch.fnmatch(alert, blocked_event) for blocked_event in sayalert_blocked_events):
if any(
fnmatch.fnmatch(alert, blocked_event)
for blocked_event in sayalert_blocked_events
):
logger.debug("SayAlert blocking {} as per configuration".format(alert))
continue
@ -453,7 +466,10 @@ def buildTailmessage(alerts):
)
for alert in alerts:
# Check if alert matches any pattern in the TailmessageBlockedEvents list
if any(fnmatch.fnmatch(alert, blocked_event) for blocked_event in tailmessage_blocked_events):
if any(
fnmatch.fnmatch(alert, blocked_event)
for blocked_event in tailmessage_blocked_events
):
logger.debug("Alert blocked by TailmessageBlockedEvents: {}".format(alert))
continue

@ -1,4 +1,4 @@
; SkywarnPlus Configuration File
; SkywarnPlus v0.1.0 Configuration File
; by Mason Nelson (N5LSN/WRKF394)
; Please update this file according to your setup and preferences
[SKYWARNPLUS]

Loading…
Cancel
Save

Powered by TurnKey Linux.