Commit 210eccd0 authored by Vasilis Tsiligiannis's avatar Vasilis Tsiligiannis

Post more client metadata

Signed-off-by: Vasilis Tsiligiannis's avatarVasilis Tsiligiannis <[email protected]>
parent 71630435
Pipeline #21539978 passed with stage
in 4 minutes and 3 seconds
......@@ -152,10 +152,14 @@ class Observer(object):
url = urljoin(base_url, str(self.observation_id))
if not url.endswith('/'):
url += '/'
client_metadata = gnuradio_handler.get_gnuradio_info()
client_metadata['latitude'] = settings.SATNOGS_STATION_LAT
client_metadata['longtitude'] = settings.SATNOGS_STATION_LON
client_metadata['elevation'] = settings.SATNOGS_STATION_ELEV
resp = requests.put(
url, headers=headers,
data={'client_version': satnogsclient.config.VERSION,
'client_metadata': json.dumps(gnuradio_handler.get_gnuradio_info())},
'client_metadata': json.dumps(client_metadata)},
verify=settings.SATNOGS_VERIFY_SSL,
stream=True,
timeout=45)
......
......@@ -12,7 +12,17 @@ def get_gnuradio_info():
process = subprocess.Popen(['python', '-m', 'satnogs.satnogs_info'],
stdout=subprocess.PIPE)
gr_satnogs_info, _ = process.communicate() # pylint: disable=W0612
client_metadata = {'radio': 'gr-satnogs'}
client_metadata = {
'radio': {
'name': 'gr-satnogs',
'rx_dexvice': client_settings.SATNOGS_RX_DEVICE,
'ppm_error': client_settings.SATNOGS_PPM_ERROR,
'if_gain': client_settings.SATNOGS_IF_GAIN,
'rf_gain': client_settings.SATNOGS_RF_GAIN,
'bb_gain': client_settings.SATNOGS_BB_GAIN,
'antenna': client_settings.SATNOGS_ANTENNA,
}
}
if process.returncode == 0:
# Convert to valid JSON
gr_satnogs_info = ''.join(gr_satnogs_info.partition('{')[1:])
......@@ -20,12 +30,12 @@ def get_gnuradio_info():
try:
gr_satnogs_info = json.loads(gr_satnogs_info)
except ValueError:
client_metadata['radio_version'] = 'invalid'
client_metadata['radio']['version'] = 'invalid'
else:
if 'version' in gr_satnogs_info:
client_metadata['radio_version'] = gr_satnogs_info['version']
client_metadata['radio']['version'] = gr_satnogs_info['version']
else:
client_metadata['radio_version'] = 'unknown'
client_metadata['radio']['oversion'] = 'unknown'
return client_metadata
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment