1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-21 11:27:38 +03:00

Send EDShipyard and Coriolis links

This commit is contained in:
Jonathan Harris 2018-01-02 17:13:02 +00:00
parent f95baf4ae4
commit 720a83db36

@ -7,7 +7,6 @@ import requests
import sys
import time
import urllib2
from calendar import timegm
from Queue import Queue
from threading import Thread
@ -34,6 +33,7 @@ this = sys.modules[__name__] # For holding module globals
this.session = requests.Session()
this.queue = Queue() # Items to be sent to EDSM by worker thread
this.discardedEvents = [] # List discarded events from EDSM
this.lastship = None # Description of last ship that we sent to EDSM
this.lastlookup = False # whether the last lookup succeeded
# Game state
@ -241,6 +241,15 @@ def cmdr_data(data, is_beta):
this.lastlookup = False
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, 'url': coriolis.url(data, is_beta) } ))
this.queue.put((cmdr, { 'event': 'EDShipyard', 'timestamp': timestamp, 'url': edshipyard.url(data, is_beta) } ))
this.lastship = ship
# Worker thread
def worker():