From d812e9e73fdb5db5a5328b47bbd97eb8cb23d9b0 Mon Sep 17 00:00:00 2001 From: "Daniel L. Srebnick" Date: Thu, 6 Feb 2020 08:19:06 -0500 Subject: [PATCH] If message truncated prioritize adjacent zones for retention --- noaacap/DEBIAN/control | 2 +- noaacap/DEBIAN/copyright | 2 +- noaacap/etc/noaacap.conf | 4 +++- noaacap/usr/local/bin/noaacap.py | 20 +++++++++++++++++--- noaacap/usr/local/share/noaacap/CHANGELOG | 4 ++++ noaacap/usr/local/share/noaacap/LICENSE | 2 +- noaacap/usr/local/share/noaacap/README | 6 +++++- 7 files changed, 32 insertions(+), 8 deletions(-) diff --git a/noaacap/DEBIAN/control b/noaacap/DEBIAN/control index 2df55d3..6bba399 100644 --- a/noaacap/DEBIAN/control +++ b/noaacap/DEBIAN/control @@ -1,5 +1,5 @@ Package: noaacap -Version: 0.9.2 +Version: 1.0.0 Section: hamradio Priority: extra Maintainer: Dan Srebnick diff --git a/noaacap/DEBIAN/copyright b/noaacap/DEBIAN/copyright index 77d465e..ce27b2d 100644 --- a/noaacap/DEBIAN/copyright +++ b/noaacap/DEBIAN/copyright @@ -1,3 +1,3 @@ -Copyright: 2017-2019 Daniel L. Srebnick +Copyright: 2017-2020 Daniel L. Srebnick License: BSD-2-clause Files: * diff --git a/noaacap/etc/noaacap.conf b/noaacap/etc/noaacap.conf index 4204208..ee47fb5 100644 --- a/noaacap/etc/noaacap.conf +++ b/noaacap/etc/noaacap.conf @@ -1,5 +1,7 @@ [noaacap] myTZ = America/New_York myZone = NJC025 -myResend = 0 +myAdj1 = NJC026 +myAdj2 = NJC027 +myResend = 30 Logging = 0 diff --git a/noaacap/usr/local/bin/noaacap.py b/noaacap/usr/local/bin/noaacap.py index 3c2511d..3a0eacb 100755 --- a/noaacap/usr/local/bin/noaacap.py +++ b/noaacap/usr/local/bin/noaacap.py @@ -6,7 +6,7 @@ ## ## See /usr/local/share/noaacap/CHANGELOG for change history ## -version = "0.9.2" +version = "1.0" import sys import pytz @@ -27,9 +27,9 @@ log.addHandler(JournalHandler(SYSLOG_IDENTIFIER='noaacap')) if len(sys.argv) == 2 and sys.argv[1] == '-v': print("noaacap.py by K2IE, version " + version + "\n") - print("A weather alert beacon exec for aprx >= 2.9") + print("A weather alert beacon exec for aprx >= 2.9 and Direwolf >= 1.3") print("Licensed under the BSD 2 Clause license") - print("Copyright 2017-2019 by Daniel L. Srebnick\n") + print("Copyright 2017-2020 by Daniel L. Srebnick\n") sys.exit(0) # We need this function early in execution @@ -77,6 +77,16 @@ except: log.error("Check " + conffile + " for proper myZone value in [noaacap] section") ErrExit() +try: + adjZone1 = config.get('noaacap', 'adjZone1') +except: + adjZone1 = '' + +try: + adjZone2 = config.get('noaacap', 'adjZone2') +except: + adjZone2 = '' + try: myResend = int(config.get('noaacap', 'myResend')) except: @@ -305,6 +315,10 @@ for i in range(0, count): if not myZone in parsezcs(zcs): zcs = myZone + "-" + zcs message = exputc + "z," + type + "," + zcs + if adjZone1 not equal '': + zcs = adjZone1 + "-" + zcs + if adjZone2 not equal '': + zcs = adjZone2 + "-" + zcs if n > 0: log.info("Truncated Msg: " + message) diff --git a/noaacap/usr/local/share/noaacap/CHANGELOG b/noaacap/usr/local/share/noaacap/CHANGELOG index 7bc7060..d4599da 100644 --- a/noaacap/usr/local/share/noaacap/CHANGELOG +++ b/noaacap/usr/local/share/noaacap/CHANGELOG @@ -1,5 +1,9 @@ noaacap changelog ## +Version: 1.0 +Release: February 6, 2020 +Added ability to specify up to 2 adjacent zones +## Version: 0.9 Release: February 20, 2018 Added timeout for non/slow response of NWS servers diff --git a/noaacap/usr/local/share/noaacap/LICENSE b/noaacap/usr/local/share/noaacap/LICENSE index ac7faeb..499c68b 100644 --- a/noaacap/usr/local/share/noaacap/LICENSE +++ b/noaacap/usr/local/share/noaacap/LICENSE @@ -1,6 +1,6 @@ BSD 2-Clause License -Copyright (c) 2017-2019, Daniel L. Srebnick +Copyright (c) 2017-2020, Daniel L. Srebnick All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/noaacap/usr/local/share/noaacap/README b/noaacap/usr/local/share/noaacap/README index 21c2cc1..8e00296 100644 --- a/noaacap/usr/local/share/noaacap/README +++ b/noaacap/usr/local/share/noaacap/README @@ -66,6 +66,10 @@ myResend should be set to 0 for no message resends or to an interval of your choosing. If noaacap beacons every 2 minutes, a value of 30 would provide hourly resends. +adjZone1 and adjZone2 may be optionally specified. If specified, those zones +are guaranteed to be retained in any messages found for myZone that have been +truncated because of length. + Logging values are 0 (quiet), 1 (informational), and 2 (debug). Logs are written to the systemd journal. You may view the logs in realtime using the following command: sudo journalctl -f | grep noaacap. @@ -77,4 +81,4 @@ k2ie@k2ie.net with the callsign-SSID of your APRS station that is sending weather alerts via this program. Dan Srebnick, K2IE -09/23/19 +02/06/2020