From 7d022016febd1aa681553fdc85f7eb67b1d795c1 Mon Sep 17 00:00:00 2001 From: Jonathan Harris Date: Sun, 7 Jan 2018 01:46:37 +0000 Subject: [PATCH] Don't send ship info to EDSM if EDSM sync not requested or on a crew Fixes #280 --- plugins/edsm.py | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/plugins/edsm.py b/plugins/edsm.py index d04d2dea..06ba70dc 100644 --- a/plugins/edsm.py +++ b/plugins/edsm.py @@ -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