Skip to content

Commit

Permalink
Further bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
K2IE committed Mar 26, 2024
1 parent 64c4b77 commit 0366878
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions noaacap/usr/local/bin/noaacap.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,13 @@ def ErrExit():
log.debug("Entry count: " + str(count))

dbfile = '/dev/shm/noaaconf.db'
if (count == 0):
log.info("Exiting - no events found")
if os.path.isfile(dbfile):
os.remove(dbfile)
print()
exit(0)

ppmap = '/usr/local/share/noaacap/ppmap.db'

sg = {"W":"WARN ","A":"WATCH","Y":"ADVIS","S":"STMNT","F":"4CAST",
Expand All @@ -140,19 +147,14 @@ def vtecparse(value):
for i in range(0, count):

log.debug("Processing entry: " + str(i + 1))
if ("no active" in entries[i].title.string):
if os.path.isfile(dbfile):
os.remove(dbfile)
break
else:
if i == 0:
alerts = db.DB()
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)
if i == 0:
alerts = db.DB()
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)

updated = entries[i].updated.string

Expand Down Expand Up @@ -211,6 +213,8 @@ def vtecparse(value):

id = bytes(str(Office + Phenomena + Significance + ETN), 'utf-8')

log.debug("ID: " + id.decode('utf-8'))

# Do we have this alert?
if id in alerts:
# Is the updated time unchanged?
Expand Down

0 comments on commit 0366878

Please sign in to comment.