mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-06-02 00:21:05 +03:00
EDDN: Send 'NavRoute' data on appropriate schema
Yes, there's some lovely mis-match between Mapping and Dict type to work around. Mapping complains about lack of __delitem__, so saying it's a Dict instead and ensuring that matches at the call site.
This commit is contained in:
parent
7081a5a3ab
commit
0ffbb4dac9
@ -846,6 +846,62 @@ Msg:\n{msg}'''
|
|||||||
this.eddn.export_journal_entry(cmdr, entry, msg)
|
this.eddn.export_journal_entry(cmdr, entry, msg)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
def export_journal_navroute(
|
||||||
|
self, cmdr: str, is_beta: bool, entry: Dict[str, Any]
|
||||||
|
) -> Optional[str]:
|
||||||
|
"""
|
||||||
|
Send a NavRoute to EDDN on the correct schema.
|
||||||
|
|
||||||
|
:param cmdr: the commander under which this upload is made
|
||||||
|
:param is_beta: whether or not we are in beta mode
|
||||||
|
:param entry: the journal entry to send
|
||||||
|
"""
|
||||||
|
# {
|
||||||
|
# "timestamp":"2021-09-24T14:33:15Z",
|
||||||
|
# "event":"NavRoute",
|
||||||
|
# "Route":[
|
||||||
|
# {
|
||||||
|
# "StarSystem":"Ross 332",
|
||||||
|
# "SystemAddress":3657198211778,
|
||||||
|
# "StarPos":[-43.62500,-23.15625,-74.12500],
|
||||||
|
# "StarClass":"K"
|
||||||
|
# },
|
||||||
|
# {
|
||||||
|
# "StarSystem":"BD+44 1040",
|
||||||
|
# "SystemAddress":2832564490946,
|
||||||
|
# "StarPos":[-31.56250,1.84375,-92.37500],
|
||||||
|
# "StarClass":"K"
|
||||||
|
# },
|
||||||
|
# {
|
||||||
|
# "StarSystem":"Aonga",
|
||||||
|
# "SystemAddress":6680855188162,
|
||||||
|
# "StarPos":[-34.46875,9.53125,-90.87500],
|
||||||
|
# "StarClass":"M"
|
||||||
|
# }
|
||||||
|
# ]
|
||||||
|
# }
|
||||||
|
#######################################################################
|
||||||
|
# Elisions
|
||||||
|
#######################################################################
|
||||||
|
# This will reject with the Odyssey flag present
|
||||||
|
if entry.get('odyssey') is not None:
|
||||||
|
del entry['odyssey']
|
||||||
|
#######################################################################
|
||||||
|
|
||||||
|
#######################################################################
|
||||||
|
# Augmentations
|
||||||
|
#######################################################################
|
||||||
|
# None
|
||||||
|
#######################################################################
|
||||||
|
|
||||||
|
msg = {
|
||||||
|
'$schemaRef': f'https://eddn.edcd.io/schemas/navroute/1{"/test" if is_beta else ""}',
|
||||||
|
'message': entry
|
||||||
|
}
|
||||||
|
|
||||||
|
this.eddn.export_journal_entry(cmdr, entry, msg)
|
||||||
|
return None
|
||||||
|
|
||||||
def canonicalise(self, item: str) -> str:
|
def canonicalise(self, item: str) -> str:
|
||||||
"""
|
"""
|
||||||
Canonicalise the given commodity name.
|
Canonicalise the given commodity name.
|
||||||
@ -1083,6 +1139,9 @@ def journal_entry( # noqa: C901, CCR001
|
|||||||
if entry['event'].lower() == 'scanbarycentre':
|
if entry['event'].lower() == 'scanbarycentre':
|
||||||
return this.eddn.export_journal_scanbarycentre(cmdr, is_beta, entry)
|
return this.eddn.export_journal_scanbarycentre(cmdr, is_beta, entry)
|
||||||
|
|
||||||
|
if entry['event'].lower() == 'navroute':
|
||||||
|
return this.eddn.export_journal_navroute(cmdr, is_beta, dict(entry))
|
||||||
|
|
||||||
# Send journal schema events to EDDN, but not when on a crew
|
# Send journal schema events to EDDN, but not when on a crew
|
||||||
if (config.get_int('output') & config.OUT_SYS_EDDN and not state['Captain'] and
|
if (config.get_int('output') & config.OUT_SYS_EDDN and not state['Captain'] and
|
||||||
(entry['event'] in ('Location', 'FSDJump', 'Docked', 'Scan', 'SAASignalsFound', 'CarrierJump')) and
|
(entry['event'] in ('Location', 'FSDJump', 'Docked', 'Scan', 'SAASignalsFound', 'CarrierJump')) and
|
||||||
|
Loading…
x
Reference in New Issue
Block a user