1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-17 01:22:19 +03:00

Translate ship names in flight log.

This commit is contained in:
Jonathan Harris 2015-06-23 13:57:22 +01:00
parent fe671488c7
commit d28bf65e2b

View File

@ -18,7 +18,7 @@ def openlog():
if logfile: return
try:
logfile = open(join(config.get('outdir'), 'Flight Log.csv'), 'a+')
logfile = open(join(config.get('outdir'), 'Flight Log.csv'), 'a+b')
if platform != 'win32': # open for writing is automatically exclusive on Windows
from fcntl import lockf, LOCK_SH, LOCK_NB
lockf(logfile, LOCK_SH|LOCK_NB)
@ -50,6 +50,6 @@ def export(data):
time.strftime('%H:%M:%S', time.localtime(querytime)),
data['lastSystem']['name'],
data['commander']['docked'] and data['lastStarport']['name'] or '',
data['ship']['name'],
ship_map.get(data['ship']['name'], data['ship']['name']),
','.join([('%d %s' % (x['qty'], commodity_map.get(x['commodity'],x['commodity']))) for x in data['ship']['cargo']['items'] if x['commodity']!='drones'])))
logfile.flush()