Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
kdudkov committed Sep 22, 2020
1 parent b048e1e commit 54c5328
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions osky.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@ def state2cot(s):
cot = ET.Element('event')
cot.set('version', '2.0')
cot.set('uid', 'icao24-' + s[0].lower())
if s[8]:
cot.set('type', 'a-f-G-C-F')
else:
cot.set('type', 'a-f-A-C-F')
cot.set('type', 'a-n-A-C-F')
cot.set('how', 'm-g')
cot.set('time', time.strftime(TIME_FORMAT, time.gmtime()))
cot.set('start', time.strftime(TIME_FORMAT, time.gmtime()))
Expand Down Expand Up @@ -90,20 +87,24 @@ def get_info(latmin, lonmin, latmax, lonmax):
parser.add_argument("--proto", help="protocol to send: tcp, udp or broadcast", default="broadcast")
parser.add_argument("--addr", help="address")
parser.add_argument("--port", help="port", type=int, default=0)
parser.add_argument("--latmin", help="min latitude", type=float, default=59.3)
parser.add_argument("--lonmin", help="min longutude", type=float, default=29.0)
parser.add_argument("--latmax", help="max latitude", type=float, default=60.3)
parser.add_argument("--lonmax", help="max longutude", type=float, default=32.2)
parser.add_argument("--latmin", help="min latitude", type=float, default=55.0)
parser.add_argument("--lonmin", help="min longutude", type=float, default=20.0)
parser.add_argument("--latmax", help="max latitude", type=float, default=65.0)
parser.add_argument("--lonmax", help="max longutude", type=float, default=40.0)
parser.add_argument("--debug", help="debug output", action="store_true")
args = parser.parse_args()

states = get_info(args.latmin, args.lonmin, args.latmax, args.lonmax)

print('got %d planes' % len(states))
if states is None:
print('Got no aircrafts')
sys.exit(1)

print('got %d aircraft' % len(states))
sender = None
if args.proto.lower() == 'udp':
addr = args.addr or '127.0.0.1'
port = args.port or 4242
port = args.port or 8999
print('sending via udp to %s:%d' % (addr, port))
sender = send_udp
elif args.proto.lower() == 'tcp':
Expand Down

0 comments on commit 54c5328

Please sign in to comment.