Prepare for 0.7 release
This commit is contained in:
parent
7982c94e53
commit
fd74397415
4
README
4
README
|
|
@ -49,6 +49,10 @@ at https://alerts.weather.gov/. Only list one county. The program will then
|
|||
send the alert for all affected zones. You could instead use a zone code if
|
||||
you want to be more specific.
|
||||
|
||||
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.
|
||||
|
||||
USE
|
||||
|
||||
It would be good to hear from users of this software. Please email
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
[noaacap]
|
||||
myTZ = America/New_York
|
||||
myZone = NJZ014
|
||||
myResend = 0
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
##
|
||||
## See /usr/local/share/noaacap/CHANGELOG for change history
|
||||
##
|
||||
version = "0.6"
|
||||
version = "0.7"
|
||||
|
||||
import sys
|
||||
import pytz
|
||||
|
|
@ -24,7 +24,7 @@ from systemd.journal import JournalHandler
|
|||
|
||||
log = logging.getLogger('noaacap')
|
||||
log.addHandler(JournalHandler(SYSLOG_IDENTIFIER='noaacap'))
|
||||
log.setLevel(logging.INFO)
|
||||
log.setLevel(logging.DEBUG)
|
||||
log.info("Starting")
|
||||
|
||||
if len(sys.argv) == 2 and sys.argv[1] == '-v':
|
||||
|
|
@ -66,6 +66,14 @@ except:
|
|||
log.error("Check " + conffile + " for proper myZone value in [noaacap] section")
|
||||
Exiting()
|
||||
|
||||
try:
|
||||
myResend = int(config.get('noaacap', 'myResend'))
|
||||
except:
|
||||
log.error("Check " + conffile + " for proper myResend value in [noaacap] section")
|
||||
log.error("Try 0 (for no resend)")
|
||||
log.error("or 30 (for 1h if beacon cycle-size 2m)")
|
||||
Exiting()
|
||||
|
||||
url = 'https://alerts.weather.gov/cap/wwaatmget.php?x=' + myZone + '&y=0'
|
||||
|
||||
r = requests.get(url)
|
||||
|
|
@ -152,7 +160,10 @@ for i in range(0, count):
|
|||
else:
|
||||
if i == 0:
|
||||
alerts = db.DB()
|
||||
alerts.open(dbfile, None, db.DB_HASH, db.DB_CREATE)
|
||||
alerts.open(dbfile, "Alerts", db.DB_HASH, db.DB_CREATE)
|
||||
if myResend > 0:
|
||||
resend = db.DB()
|
||||
resend.open(dbfile, "Resend", db.DB_HASH, db.DB_CREATE)
|
||||
pp = db.DB()
|
||||
pp.open(ppmap, None, db.DB_HASH, db.DB_RDONLY)
|
||||
|
||||
|
|
@ -172,9 +183,26 @@ for i in range(0, count):
|
|||
|
||||
id = bytes(str(Office + Phenomena + Significance + ETN), 'utf-8')
|
||||
|
||||
# Do we have this alert?
|
||||
if alerts.has_key(id):
|
||||
# Is the updated time unchanged?
|
||||
if alerts[id].decode('utf-8') == updated:
|
||||
log.debug(id.decode('utf-8') + " " + updated + " found")
|
||||
# Is resend behavoir desired?
|
||||
if myResend > 0:
|
||||
|
||||
try:
|
||||
recount = int(resend[id].decode('utf-8')) - 1
|
||||
except:
|
||||
resend[id] = bytes(str(myResend), 'utf-8')
|
||||
recount = int(resend[id].decode('utf-8')) - 1
|
||||
|
||||
if recount > 0:
|
||||
resend[id] = bytes(str(recount), 'utf-8')
|
||||
log.debug(id.decode('utf-8') + " resend in " + str(recount) +
|
||||
" iterations")
|
||||
continue
|
||||
else:
|
||||
continue
|
||||
|
||||
alerts[id] = updated
|
||||
|
|
@ -239,6 +267,8 @@ for i in range(0, count):
|
|||
|
||||
line = "{" + t + "00"
|
||||
print(":NWS_" + event + ":" + message + line)
|
||||
if myResend > 0:
|
||||
resend[id] = bytes(str(myResend), 'utf-8')
|
||||
|
||||
break
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,9 @@
|
|||
noaacap changelog
|
||||
##
|
||||
Version: 0.7
|
||||
Release: TBD
|
||||
Added myResend parameter to control message resends.
|
||||
##
|
||||
Version: 0.6
|
||||
Release: September 15, 2017
|
||||
Converted to Python3
|
||||
|
|
|
|||
|
|
@ -44,6 +44,10 @@ at https://alerts.weather.gov/. Only list one county. The program will then
|
|||
send the alert for all affected zones. You could instead use a zone code if
|
||||
you want to be more specific.
|
||||
|
||||
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.
|
||||
|
||||
USE
|
||||
|
||||
It would be good to hear from users of this software. Please email
|
||||
|
|
|
|||
Loading…
Reference in New Issue