diff --git a/td.py b/td.py index 1addc0e0..56788fcd 100644 --- a/td.py +++ b/td.py @@ -26,6 +26,8 @@ def export(data): filename = join(config.get('outdir'), '%s.%s.%s.prices' % (data['lastSystem']['name'].strip(), data['lastStarport']['name'].strip(), time.strftime('%Y-%m-%dT%H.%M.%S', time.localtime(querytime)))) + timestamp = time.strftime('%Y-%m-%d %H:%M:%S', time.strptime(data['timestamp'], '%Y-%m-%dT%H:%M:%SZ')) + # Format described here: https://bitbucket.org/kfsone/tradedangerous/wiki/Price%20Data h = open(filename, 'wt') # codecs can't automatically handle line endings, so encode manually where required h.write(('#! trade.py import -\n# Created by %s %s on %s%s.\n#\n# \n\n@ %s/%s\n' % (applongname, appversion, platform=='darwin' and "Mac OS" or system(), not config.getint('anonymous') and ' for Cmdr '+data['commander']['name'].strip() or '', data['lastSystem']['name'].strip(), data['lastStarport']['name'].strip())).encode('utf-8')) @@ -47,6 +49,6 @@ def export(data): demandbracketmap[commodity['demandBracket']], int(commodity['stock']) if commodity['stockBracket'] else '', stockbracketmap[commodity['stockBracket']], - data['timestamp'])) + timestamp)) h.close()