Skip to content

Commit

Permalink
Drop lines that start with something other than the first sentence, e…
Browse files Browse the repository at this point in the history
…ven when we do not have a group ID from before. Also start removing some of the logging from the initial deployment of the queue.
  • Loading branch information
schwehr committed Apr 20, 2015
1 parent 365f666 commit 551b79b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions ais/uscg.py
Expand Up @@ -99,7 +99,6 @@ def put(self, line, line_num=None):
self.line_num += 1

line = line.rstrip()
logging.info('put(%s, %s)', line, line_num)
metadata_match = Parse(line)
match = vdm.Parse(line)

Expand Down Expand Up @@ -130,7 +129,6 @@ def put(self, line, line_num=None):
sentence_tot = int(match['sen_tot'])

if sentence_tot == 1:
logging.info('Single line message')
body = match['body']
fill_bits = int(match['fill_bits'])
try:
Expand All @@ -157,6 +155,11 @@ def put(self, line, line_num=None):
if group_id not in self.groups:
self.groups[group_id] = []

if not self.groups[group_id]:
if sentence_num != 1:
# Drop a partial AIS message.
return

if sentence_num == 1:
self.groups[group_id] = {
'line_nums': [self.line_num],
Expand Down

0 comments on commit 551b79b

Please sign in to comment.