mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-04-17 17:42:20 +03:00
Add SystemAddress to EDDN journal/Scan messages
This commit is contained in:
parent
0b0ac162e1
commit
94e9ff64cc
@ -665,11 +665,13 @@ class AppWindow:
|
|||||||
entry['Body'] = monitor.planet
|
entry['Body'] = monitor.planet
|
||||||
entry['BodyType'] = 'Planet'
|
entry['BodyType'] = 'Planet'
|
||||||
|
|
||||||
# add mandatory StarSystem and StarPos properties to Scan events
|
# add mandatory StarSystem, StarPos and SystemAddress properties to Scan events
|
||||||
if 'StarSystem' not in entry:
|
if 'StarSystem' not in entry:
|
||||||
entry['StarSystem'] = monitor.system
|
entry['StarSystem'] = monitor.system
|
||||||
if 'StarPos' not in entry:
|
if 'StarPos' not in entry:
|
||||||
entry['StarPos'] = list(monitor.coordinates)
|
entry['StarPos'] = list(monitor.coordinates)
|
||||||
|
if 'SystemAddress' not in entry and monitor.systemaddress:
|
||||||
|
entry['SystemAddress'] = monitor.systemaddress
|
||||||
|
|
||||||
self.eddn.export_journal_entry(monitor.cmdr, monitor.is_beta, entry)
|
self.eddn.export_journal_entry(monitor.cmdr, monitor.is_beta, entry)
|
||||||
|
|
||||||
|
11
monitor.py
11
monitor.py
@ -102,6 +102,7 @@ class EDLogs(FileSystemEventHandler):
|
|||||||
self.station = None
|
self.station = None
|
||||||
self.stationtype = None
|
self.stationtype = None
|
||||||
self.coordinates = None
|
self.coordinates = None
|
||||||
|
self.systemaddress = None
|
||||||
self.started = None # Timestamp of the LoadGame event
|
self.started = None # Timestamp of the LoadGame event
|
||||||
|
|
||||||
# Cmdr state shared with EDSM and plugins
|
# Cmdr state shared with EDSM and plugins
|
||||||
@ -180,7 +181,7 @@ class EDLogs(FileSystemEventHandler):
|
|||||||
if __debug__:
|
if __debug__:
|
||||||
print 'Stopping monitoring Journal'
|
print 'Stopping monitoring Journal'
|
||||||
self.currentdir = None
|
self.currentdir = None
|
||||||
self.version = self.mode = self.group = self.cmdr = self.planet = self.system = self.station = self.stationtype = self.stationservices = self.coordinates = None
|
self.version = self.mode = self.group = self.cmdr = self.planet = self.system = self.station = self.stationtype = self.stationservices = self.coordinates = self.systemaddress = None
|
||||||
self.is_beta = False
|
self.is_beta = False
|
||||||
if self.observed:
|
if self.observed:
|
||||||
self.observed = None
|
self.observed = None
|
||||||
@ -234,6 +235,7 @@ class EDLogs(FileSystemEventHandler):
|
|||||||
('event', 'StartUp'),
|
('event', 'StartUp'),
|
||||||
('StarSystem', self.system),
|
('StarSystem', self.system),
|
||||||
('StarPos', self.coordinates),
|
('StarPos', self.coordinates),
|
||||||
|
('SystemAddress', self.systemaddress),
|
||||||
])
|
])
|
||||||
if self.planet:
|
if self.planet:
|
||||||
entry['Body'] = self.planet
|
entry['Body'] = self.planet
|
||||||
@ -315,6 +317,7 @@ class EDLogs(FileSystemEventHandler):
|
|||||||
self.stationtype = None
|
self.stationtype = None
|
||||||
self.stationservices = None
|
self.stationservices = None
|
||||||
self.coordinates = None
|
self.coordinates = None
|
||||||
|
self.systemaddress = None
|
||||||
self.started = None
|
self.started = None
|
||||||
self.state = {
|
self.state = {
|
||||||
'Captain' : None,
|
'Captain' : None,
|
||||||
@ -350,6 +353,7 @@ class EDLogs(FileSystemEventHandler):
|
|||||||
self.stationtype = None
|
self.stationtype = None
|
||||||
self.stationservices = None
|
self.stationservices = None
|
||||||
self.coordinates = None
|
self.coordinates = None
|
||||||
|
self.systemaddress = None
|
||||||
self.started = timegm(strptime(entry['timestamp'], '%Y-%m-%dT%H:%M:%SZ'))
|
self.started = timegm(strptime(entry['timestamp'], '%Y-%m-%dT%H:%M:%SZ'))
|
||||||
self.state.update({
|
self.state.update({
|
||||||
'Captain' : None,
|
'Captain' : None,
|
||||||
@ -426,6 +430,7 @@ class EDLogs(FileSystemEventHandler):
|
|||||||
self.coordinates = tuple(entry['StarPos'])
|
self.coordinates = tuple(entry['StarPos'])
|
||||||
elif self.system != entry['StarSystem']:
|
elif self.system != entry['StarSystem']:
|
||||||
self.coordinates = None # Docked event doesn't include coordinates
|
self.coordinates = None # Docked event doesn't include coordinates
|
||||||
|
self.systemaddress = entry.get('SystemAddress')
|
||||||
(self.system, self.station) = (entry['StarSystem'] == 'ProvingGround' and 'CQC' or entry['StarSystem'],
|
(self.system, self.station) = (entry['StarSystem'] == 'ProvingGround' and 'CQC' or entry['StarSystem'],
|
||||||
entry.get('StationName')) # May be None
|
entry.get('StationName')) # May be None
|
||||||
self.stationtype = entry.get('StationType') # May be None
|
self.stationtype = entry.get('StationType') # May be None
|
||||||
@ -548,6 +553,7 @@ class EDLogs(FileSystemEventHandler):
|
|||||||
self.stationtype = None
|
self.stationtype = None
|
||||||
self.stationservices = None
|
self.stationservices = None
|
||||||
self.coordinates = None
|
self.coordinates = None
|
||||||
|
self.systemaddress = None
|
||||||
elif entry['event'] == 'ChangeCrewRole':
|
elif entry['event'] == 'ChangeCrewRole':
|
||||||
self.state['Role'] = entry['Role']
|
self.state['Role'] = entry['Role']
|
||||||
elif entry['event'] == 'QuitACrew':
|
elif entry['event'] == 'QuitACrew':
|
||||||
@ -559,6 +565,7 @@ class EDLogs(FileSystemEventHandler):
|
|||||||
self.stationtype = None
|
self.stationtype = None
|
||||||
self.stationservices = None
|
self.stationservices = None
|
||||||
self.coordinates = None
|
self.coordinates = None
|
||||||
|
self.systemaddress = None
|
||||||
|
|
||||||
elif entry['event'] == 'Friends':
|
elif entry['event'] == 'Friends':
|
||||||
if entry['Status'] in ['Online', 'Added']:
|
if entry['Status'] in ['Online', 'Added']:
|
||||||
@ -599,6 +606,7 @@ class EDLogs(FileSystemEventHandler):
|
|||||||
('StationType', self.stationtype),
|
('StationType', self.stationtype),
|
||||||
('StarSystem', self.system),
|
('StarSystem', self.system),
|
||||||
('StarPos', self.coordinates),
|
('StarPos', self.coordinates),
|
||||||
|
('SystemAddress', self.systemaddress),
|
||||||
])
|
])
|
||||||
else:
|
else:
|
||||||
entry = OrderedDict([
|
entry = OrderedDict([
|
||||||
@ -607,6 +615,7 @@ class EDLogs(FileSystemEventHandler):
|
|||||||
('Docked', False),
|
('Docked', False),
|
||||||
('StarSystem', self.system),
|
('StarSystem', self.system),
|
||||||
('StarPos', self.coordinates),
|
('StarPos', self.coordinates),
|
||||||
|
('SystemAddress', self.systemaddress),
|
||||||
])
|
])
|
||||||
self.event_queue.append(json.dumps(entry, separators=(', ', ':')))
|
self.event_queue.append(json.dumps(entry, separators=(', ', ':')))
|
||||||
elif self.live and entry['event'] == 'Music' and entry.get('MusicTrack') == 'MainMenu':
|
elif self.live and entry['event'] == 'Music' and entry.get('MusicTrack') == 'MainMenu':
|
||||||
|
Loading…
x
Reference in New Issue
Block a user