mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-06-02 16:41:04 +03:00
revert using json.dump
windows encodings dont like the weird characters
This commit is contained in:
parent
0e0c802b04
commit
f08d60d9b1
12
EDMC.py
12
EDMC.py
@ -91,10 +91,8 @@ def main():
|
|||||||
newversion: Optional[EDMCVersion] = updater.check_appcast()
|
newversion: Optional[EDMCVersion] = updater.check_appcast()
|
||||||
if newversion:
|
if newversion:
|
||||||
print(f'{appversion} ({newversion.title!r} is available)')
|
print(f'{appversion} ({newversion.title!r} is available)')
|
||||||
|
|
||||||
else:
|
else:
|
||||||
print(appversion)
|
print(appversion)
|
||||||
|
|
||||||
sys.exit(EXIT_SUCCESS)
|
sys.exit(EXIT_SUCCESS)
|
||||||
|
|
||||||
if args.j:
|
if args.j:
|
||||||
@ -106,9 +104,7 @@ def main():
|
|||||||
# Get state from latest Journal file
|
# Get state from latest Journal file
|
||||||
try:
|
try:
|
||||||
logdir = config.get('journaldir') or config.default_journal_dir
|
logdir = config.get('journaldir') or config.default_journal_dir
|
||||||
logfiles = sorted(
|
logfiles = sorted((x for x in os.listdir(logdir) if JOURNAL_RE.search(x)), key=lambda x: x.split('.')[1:])
|
||||||
(x for x in os.listdir(logdir) if JOURNAL_RE.search(x)), key=lambda x: x.split('.')[1:]
|
|
||||||
)
|
|
||||||
|
|
||||||
logfile = join(logdir, logfiles[-1])
|
logfile = join(logdir, logfiles[-1])
|
||||||
|
|
||||||
@ -116,7 +112,6 @@ def main():
|
|||||||
for line in loghandle:
|
for line in loghandle:
|
||||||
try:
|
try:
|
||||||
monitor.parse_entry(line)
|
monitor.parse_entry(line)
|
||||||
|
|
||||||
except Exception:
|
except Exception:
|
||||||
if __debug__:
|
if __debug__:
|
||||||
print(f'Invalid journal entry {line!r}')
|
print(f'Invalid journal entry {line!r}')
|
||||||
@ -189,8 +184,9 @@ def main():
|
|||||||
|
|
||||||
# stuff we can do when not docked
|
# stuff we can do when not docked
|
||||||
if args.d:
|
if args.d:
|
||||||
with open(args.d, 'w') as f:
|
out = json.dumps(data, ensure_ascii=False, indent=2, sort_keys=True, separators=(',', ': '))
|
||||||
json.dump(data, f, ensure_ascii=False, indent=2, sort_keys=True, separators=(',', ': '))
|
with open(args.d, 'wb') as f:
|
||||||
|
f.write(out.encode("utf-8"))
|
||||||
|
|
||||||
if args.a:
|
if args.a:
|
||||||
loadout.export(data, args.a)
|
loadout.export(data, args.a)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user