summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkrakenrf <78108016+krakenrf@users.noreply.github.com>2022-10-27 03:10:54 +0200
committerGitHub <noreply@github.com>2022-10-27 03:10:54 +0200
commite0cbcfdfae612a96a10e93aa43dd8085654f4369 (patch)
treeb5c77429ab20e0ed69043683999c3010f92f32d8
parentCreate dump1090_krakenmap.py (diff)
downloadkrakensdr_docs-e0cbcfdfae612a96a10e93aa43dd8085654f4369.tar
krakensdr_docs-e0cbcfdfae612a96a10e93aa43dd8085654f4369.tar.gz
krakensdr_docs-e0cbcfdfae612a96a10e93aa43dd8085654f4369.tar.bz2
krakensdr_docs-e0cbcfdfae612a96a10e93aa43dd8085654f4369.tar.lz
krakensdr_docs-e0cbcfdfae612a96a10e93aa43dd8085654f4369.tar.xz
krakensdr_docs-e0cbcfdfae612a96a10e93aa43dd8085654f4369.tar.zst
krakensdr_docs-e0cbcfdfae612a96a10e93aa43dd8085654f4369.zip
-rw-r--r--misc_scripts/dump1090_krakenmap.py35
1 files changed, 20 insertions, 15 deletions
diff --git a/misc_scripts/dump1090_krakenmap.py b/misc_scripts/dump1090_krakenmap.py
index e34962d..63546c7 100644
--- a/misc_scripts/dump1090_krakenmap.py
+++ b/misc_scripts/dump1090_krakenmap.py
@@ -1,11 +1,9 @@
+
import requests
import json
import time
-# The unique ICAO ID of the aircraft in HEX. Ensure it is LOWERCASE.
-HEX_ID = "c822ed"
-
-API_SERVER = 'https://map.krakenrf.com:443'
+API_SERVER = 'https://kraken.tynet.eu:8842'
# Your Kraken Pro Cloud username and password
login = {'username': 'username', 'password': 'password'}
@@ -15,21 +13,28 @@ token = x.text
print(x.text)
+#beaconData = [{'id': "e80450", 'lat': -37.236809, 'lon': 171.337698, 'speed': 443, 'height': 37925, 'heading': 180},
+# {'id': "e80460", 'lat': -37.036809, 'lon': 171.137698, 'speed': 443, 'height': 37925, 'heading': 180}]
+#x = requests.post(API_SERVER + '/beacons', json = beaconData, headers = {'Authorization': token})
+
while True:
f = open('aircraft.json')
data = json.load(f)
+ beaconData = []
for aircraft in data['aircraft']:
-# print(aircraft['hex'])
- if aircraft['hex'] == HEX_ID:
- try:
- beaconData = {'lat': aircraft['lat'], 'lon': aircraft['lon'], 'speed': aircraft['gs'], 'height': aircraft['alt_geom']}
- x = requests.post(API_SERVER + '/beacon', json = beaconData, headers = {'Authorization': token})
-
- print (aircraft['lat'])
- print (aircraft['lon'])
- except:
- print('EXCEPTION: Probably out of range')
- pass #
+ try:
+ beaconData.append({'id': str(aircraft['flight']), 'lat': aircraft['lat'], 'lon': aircraft['lon'], 'speed': int(aircraft['gs']), 'height': aircraft['alt_geom'], 'heading': aircraft['mag_heading']})
+
+ #print (aircraft['flight'])
+ #print (aircraft['lat'])
+ #print (aircraft['lon'])
+ #print (aircraft['gs'])
+ #print (aircraft['alt_geom'])
+
+ except:
+ #print('excepted')
+ pass # probably lat/lon missing
+ x = requests.post(API_SERVER + '/beacons', json = beaconData, headers = {'Authorization': token})
time.sleep(1)