1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-14 16:27:13 +03:00

Don't send ship info to EDSM if EDSM sync not requested or on a crew

Fixes #280
This commit is contained in:
Jonathan Harris 2018-01-07 01:46:37 +00:00
parent 17f89afa0d
commit 7d022016fe

View File

@ -191,8 +191,10 @@ def journal_entry(cmdr, is_beta, system, station, entry, state):
this.lastlookup = False
this.system.update_idletasks()
this.multicrew = bool(state['Role'])
# Send interesting events to EDSM
if config.getint('edsm_out') and not is_beta and not state['Role'] and credentials(cmdr) and entry['event'] not in this.discardedEvents:
if config.getint('edsm_out') and not is_beta and not this.multicrew and credentials(cmdr) and entry['event'] not in this.discardedEvents:
# Introduce transient states into the event
transient = {
'_systemName': system,
@ -242,17 +244,18 @@ def cmdr_data(data, is_beta):
this.system.update_idletasks()
# Send ship info to EDSM
ship = companion.ship(data)
if ship != this.lastship:
cmdr = data['commander']['name']
timestamp = time.strftime('%Y-%m-%dT%H:%M:%SZ', time.gmtime())
this.queue.put((cmdr, {
'event': 'Coriolis', 'timestamp': timestamp, '_shipId': data['ship']['id'], 'url': coriolis.url(data, is_beta)
}))
this.queue.put((cmdr, {
'event': 'EDShipyard', 'timestamp': timestamp, '_shipId': data['ship']['id'], 'url': edshipyard.url(data, is_beta)
}))
this.lastship = ship
if config.getint('edsm_out') and not is_beta and not this.multicrew and credentials(data['commander']['name']):
ship = companion.ship(data)
if ship != this.lastship:
cmdr = data['commander']['name']
timestamp = time.strftime('%Y-%m-%dT%H:%M:%SZ', time.gmtime())
this.queue.put((cmdr, {
'event': 'Coriolis', 'timestamp': timestamp, '_shipId': data['ship']['id'], 'url': coriolis.url(data, is_beta)
}))
this.queue.put((cmdr, {
'event': 'EDShipyard', 'timestamp': timestamp, '_shipId': data['ship']['id'], 'url': edshipyard.url(data, is_beta)
}))
this.lastship = ship
# Worker thread