-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sped up redis receiver a little. Also better configuration.
- Loading branch information
Showing
3 changed files
with
26 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
plot/* | ||
plot* | ||
plot.* | ||
output.* | ||
.ipynb_checkpoints |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,25 @@ | ||
import socket | ||
import redis | ||
import socket | ||
|
||
# redis server | ||
REDIS_HOST = 'localhost' | ||
REDIS_PORT = 6379 | ||
# ADSB feeder | ||
FEEDER_HOST = '192.168.249.26' | ||
FEEDER_PORT = 30003 | ||
# TTL of records, in seconds | ||
EXPIRATION = 1200 | ||
|
||
r = redis.Redis(host='localhost', port=6379, db=0) | ||
r = redis.Redis(host=REDIS_HOST, port=REDIS_PORT, db=0) | ||
|
||
|
||
sock = socket.socket() | ||
sf = sock.makefile() | ||
sock.connect(('192.168.249.26', 30003)) | ||
sock.connect((FEEDER_HOST, FEEDER_PORT)) | ||
while(True): | ||
fields = sf.readline().split(',') | ||
if(fields[0] == 'MSG' and fields[1] == '3'): | ||
if(fields[14].strip != '' and fields[15].strip != '' and fields[11].strip != ''): | ||
coords = ','.join([fields[14], fields[15], fields[11]]) | ||
r.setex(coords, 3600, coords) | ||
r.setex(coords, EXPIRATION, '') | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters