1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-06-09 20:02:11 +03:00

Inara: Only ApproachSettlement if we have system & fix key case

* If you're near a settlement on login you get an ApproachSettlement
  before `monitor` has system set to pass into `journal_entry()`.
* We had a case-type of an Inara API key, so it wasn't setting the
  BodyName.
* TRACE level logging of what we actually send to Inara.
This commit is contained in:
Athanasius 2021-06-04 18:45:43 +01:00
parent fa0a7c48a2
commit f6777f0237

View File

@ -630,14 +630,17 @@ def journal_entry( # noqa: C901, CCR001
new_add_event('setCommanderTravelLocation', entry['timestamp'], to_send) new_add_event('setCommanderTravelLocation', entry['timestamp'], to_send)
elif event_name == 'ApproachSettlement': elif event_name == 'ApproachSettlement':
to_send = { # If you're near a Settlement on login this event is recorded, but
'starsystemName': system, # we might not yet have system logged for use.
'stationName': entry['Name'], if system:
'marketid': entry['MarketID'], to_send = {
'starsystemBodyName': entry['BodyName'], 'starsystemName': system,
'starsystemBodyCoords': [entry['Latitude'], entry['Longitude']] 'stationName': entry['Name'],
} 'marketid': entry['MarketID'],
new_add_event('setCommanderTravelLocation', entry['timestamp'], to_send) 'starsystemBodyName': entry['BodyName'],
'starsystemBodyCoords': [entry['Latitude'], entry['Longitude']]
}
new_add_event('setCommanderTravelLocation', entry['timestamp'], to_send)
elif event_name == 'FSDJump': elif event_name == 'FSDJump':
this.undocked = False this.undocked = False
@ -1197,7 +1200,7 @@ def journal_entry( # noqa: C901, CCR001
# These were included thus we are landed # These were included thus we are landed
to_send['starsystemBodyCoords'] = [entry['Latitude'], entry['Longitude']] to_send['starsystemBodyCoords'] = [entry['Latitude'], entry['Longitude']]
# if we're not Docked, but have these, we're either landed or close enough that it doesn't matter. # if we're not Docked, but have these, we're either landed or close enough that it doesn't matter.
to_send['starSystemBodyName'] = entry['Body'] to_send['starsystemBodyName'] = entry['Body']
new_add_event('setCommanderTravelLocation', entry['timestamp'], to_send) new_add_event('setCommanderTravelLocation', entry['timestamp'], to_send)
@ -1483,6 +1486,7 @@ def new_worker():
] ]
} }
logger.info(f'sending {len(data["events"])} events for {creds.cmdr}') logger.info(f'sending {len(data["events"])} events for {creds.cmdr}')
logger.trace(f'Events:\n{json.dumps(data)}\n')
try_send_data(TARGET_URL, data) try_send_data(TARGET_URL, data)
time.sleep(WORKER_WAIT_TIME) time.sleep(WORKER_WAIT_TIME)