Merge branch 'master' of https://github.com/K2IE/noaacap
This commit is contained in:
commit
41dc1ad8a7
|
|
@ -1,5 +1,5 @@
|
||||||
Package: noaacap
|
Package: noaacap
|
||||||
Version: 1.4.0
|
Version: 1.5
|
||||||
Section: hamradio
|
Section: hamradio
|
||||||
Priority: extra
|
Priority: extra
|
||||||
Maintainer: Dan Srebnick <k2ie at k2ie.net>
|
Maintainer: Dan Srebnick <k2ie at k2ie.net>
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
Copyright: 2017-2020 Daniel L. Srebnick <k2ie@k2ie.net>
|
Copyright: 2017-2025 Daniel L. Srebnick <k2ie@k2ie.net>
|
||||||
License: BSD-2-clause
|
License: BSD-2-clause
|
||||||
Files: *
|
Files: *
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
##
|
##
|
||||||
## See /usr/local/share/noaacap/CHANGELOG for change history
|
## See /usr/local/share/noaacap/CHANGELOG for change history
|
||||||
##
|
##
|
||||||
version = "1.4.0"
|
version = "1.5"
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import pytz
|
import pytz
|
||||||
|
|
@ -22,6 +22,7 @@ import configparser
|
||||||
import re
|
import re
|
||||||
import logging
|
import logging
|
||||||
from systemd.journal import JournalHandler
|
from systemd.journal import JournalHandler
|
||||||
|
import argparse
|
||||||
|
|
||||||
log = logging.getLogger('noaacap')
|
log = logging.getLogger('noaacap')
|
||||||
log.addHandler(JournalHandler(SYSLOG_IDENTIFIER='noaacap'))
|
log.addHandler(JournalHandler(SYSLOG_IDENTIFIER='noaacap'))
|
||||||
|
|
@ -30,16 +31,26 @@ if len(sys.argv) == 2 and sys.argv[1] == '-v':
|
||||||
print("noaacap.py by K2IE, version " + version + "\n")
|
print("noaacap.py by K2IE, version " + version + "\n")
|
||||||
print("A weather alert beacon exec for aprx >= 2.9 and Direwolf >= 1.3")
|
print("A weather alert beacon exec for aprx >= 2.9 and Direwolf >= 1.3")
|
||||||
print("Licensed under the BSD 2 Clause license")
|
print("Licensed under the BSD 2 Clause license")
|
||||||
print("Copyright 2017-2024 by Daniel L. Srebnick\n")
|
print("Copyright 2017-2025 by Daniel L. Srebnick\n")
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
|
# Command-line argument parsing
|
||||||
|
parser = argparse.ArgumentParser(description="noaacap.py - APRS Weather Alerts beacon exec for aprx & Dire Wolf")
|
||||||
|
parser.add_argument('--config', '-c',
|
||||||
|
help='Path to the configuration file (default: /etc/noaacap.conf)',
|
||||||
|
default='/etc/noaacap.conf')
|
||||||
|
parser.add_argument('--dbfile', '-d',
|
||||||
|
help='Path to the database file (default: /dev/shm/noaaconf.db)',
|
||||||
|
default='/dev/shm/noaaconf.db')
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
# We need this function early in execution
|
# We need this function early in execution
|
||||||
def ErrExit():
|
def ErrExit():
|
||||||
log.error("Exiting")
|
log.error("Exiting")
|
||||||
print()
|
print()
|
||||||
exit(0)
|
exit(0)
|
||||||
|
|
||||||
conffile = '/etc/noaacap.conf'
|
conffile = args.config
|
||||||
|
|
||||||
if not os.path.isfile(conffile):
|
if not os.path.isfile(conffile):
|
||||||
log.error(conffile + " not found")
|
log.error(conffile + " not found")
|
||||||
|
|
@ -112,7 +123,7 @@ soup = BeautifulSoup(r.text, 'xml')
|
||||||
entries = soup.find_all('entry')
|
entries = soup.find_all('entry')
|
||||||
count = len(entries)
|
count = len(entries)
|
||||||
|
|
||||||
dbfile = '/dev/shm/noaaconf.db'
|
dbfile = args.dbfile
|
||||||
if count == 0:
|
if count == 0:
|
||||||
log.info("Exiting - no events found")
|
log.info("Exiting - no events found")
|
||||||
if os.path.isfile(dbfile):
|
if os.path.isfile(dbfile):
|
||||||
|
|
@ -194,9 +205,9 @@ for i in range(0, count):
|
||||||
EventBegin, EventEnd = vtecparse(VTEC)
|
EventBegin, EventEnd = vtecparse(VTEC)
|
||||||
except:
|
except:
|
||||||
log.debug("VTEC parse failed")
|
log.debug("VTEC parse failed")
|
||||||
continue #Loop if error parsing P-VTEC
|
continue #Loop if error parsing P-VTEC
|
||||||
|
|
||||||
if ProductClass != "/O": #Loop if not operational
|
if ProductClass != "/O": #Loop if not operational
|
||||||
continue
|
continue
|
||||||
|
|
||||||
EventEnd = "20" + EventEnd
|
EventEnd = "20" + EventEnd
|
||||||
|
|
@ -281,7 +292,9 @@ for i in range(0, count):
|
||||||
sorted_zcs = (sorted(zcs_discrete))
|
sorted_zcs = (sorted(zcs_discrete))
|
||||||
|
|
||||||
# Move myZone to first position in case of truncation
|
# Move myZone to first position in case of truncation
|
||||||
move_entry(sorted_zcs,myZone,0)
|
if myZone in sorted_zcs:
|
||||||
|
move_entry(sorted_zcs,myZone,0)
|
||||||
|
log.debug("myZone found in sorted zcs and moved to index 0")
|
||||||
|
|
||||||
# Move adjacent zones, if present, after myZone
|
# Move adjacent zones, if present, after myZone
|
||||||
adjZone2Index = 1
|
adjZone2Index = 1
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,17 @@
|
||||||
noaacap changelog
|
noaacap changelog
|
||||||
##
|
##
|
||||||
|
Version: 1.5
|
||||||
|
Release: June 25, 2025
|
||||||
|
Add command argument parsing
|
||||||
|
##
|
||||||
|
Version: 1.4.1
|
||||||
|
Release: June 23, 2025
|
||||||
|
Add XH phenomena and fix county bug
|
||||||
|
##
|
||||||
|
Version: 1.4
|
||||||
|
Release: April 3, 2024
|
||||||
|
Complete rewrite of zone parsing
|
||||||
|
##
|
||||||
Version: 1.3.1
|
Version: 1.3.1
|
||||||
Release: April 2, 2024
|
Release: April 2, 2024
|
||||||
Fix expiration date parsing issue
|
Fix expiration date parsing issue
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
The current release of noaacap is 1.4.0. If you are running older than this
|
The current release of noaacap is 1.5. If you are running an older version
|
||||||
version, please update before asking for support.
|
than this, please update before asking for support.
|
||||||
|
|
||||||
This software is written in python3 and has been tested with aprx 2.9.x.
|
This software is written in python3 and has been tested with aprx 2.9.x.
|
||||||
If you are running a version < 2.9.0 you should first update aprx. The current
|
If you are running a version < 2.9.0 you should first update aprx. The current
|
||||||
|
|
@ -63,8 +63,8 @@ the following command: timedatectl list-timezones | grep America.
|
||||||
myZone should be set to your zone code. A list of zone codes may be found
|
myZone should be set to your zone code. A list of zone codes may be found
|
||||||
at https://www.weather.gov/pimar/PubZone. Only list one zone. The program
|
at https://www.weather.gov/pimar/PubZone. Only list one zone. The program
|
||||||
will send the alert for all affected zones that will fit in the allocated 67
|
will send the alert for all affected zones that will fit in the allocated 67
|
||||||
characters. You could instead use a county code if you wish. However the
|
characters. You could instead use a county code, if you wish. However,
|
||||||
associated zone may also be sent, wasting characters.
|
NOAA now seems to return zones rather than counties in some cases.
|
||||||
|
|
||||||
As an example, if you're located in Lancaster, PA, the map shows that you
|
As an example, if you're located in Lancaster, PA, the map shows that you
|
||||||
are in zone 066. Enter PAZ066 for myZone.
|
are in zone 066. Enter PAZ066 for myZone.
|
||||||
|
|
@ -89,4 +89,4 @@ weather alerts via this program.
|
||||||
|
|
||||||
Dan Srebnick, K2IE
|
Dan Srebnick, K2IE
|
||||||
02/06/2020
|
02/06/2020
|
||||||
Updated 04/03/2024
|
Updated 06/25/2025
|
||||||
|
|
|
||||||
Binary file not shown.
Loading…
Reference in New Issue