mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-06-14 06:12:31 +03:00
Send EDShipyard and Coriolis links
This commit is contained in:
parent
f95baf4ae4
commit
720a83db36
@ -7,7 +7,6 @@ import requests
|
|||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
import urllib2
|
import urllib2
|
||||||
from calendar import timegm
|
|
||||||
from Queue import Queue
|
from Queue import Queue
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
|
|
||||||
@ -34,6 +33,7 @@ this = sys.modules[__name__] # For holding module globals
|
|||||||
this.session = requests.Session()
|
this.session = requests.Session()
|
||||||
this.queue = Queue() # Items to be sent to EDSM by worker thread
|
this.queue = Queue() # Items to be sent to EDSM by worker thread
|
||||||
this.discardedEvents = [] # List discarded events from EDSM
|
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
|
this.lastlookup = False # whether the last lookup succeeded
|
||||||
|
|
||||||
# Game state
|
# Game state
|
||||||
@ -241,6 +241,15 @@ def cmdr_data(data, is_beta):
|
|||||||
this.lastlookup = False
|
this.lastlookup = False
|
||||||
this.system.update_idletasks()
|
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
|
# Worker thread
|
||||||
def worker():
|
def worker():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user