mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-06-05 18:03:17 +03:00
Handle new Cargo event variant in 3.3
This commit is contained in:
parent
10b36aa60b
commit
8c3b0b8de3
@ -491,6 +491,9 @@ class EDLogs(FileSystemEventHandler):
|
|||||||
|
|
||||||
elif entry['event'] == 'Cargo':
|
elif entry['event'] == 'Cargo':
|
||||||
self.state['Cargo'] = defaultdict(int)
|
self.state['Cargo'] = defaultdict(int)
|
||||||
|
if 'Inventory' not in entry: # From 3.3 full Cargo event (after the first one) is written to a separate file
|
||||||
|
with open(join(self.currentdir, 'Cargo.json'), 'rb') as h:
|
||||||
|
entry = json.load(h, object_pairs_hook=OrderedDict) # Preserve property order because why not?
|
||||||
self.state['Cargo'].update({ self.canonicalise(x['Name']): x['Count'] for x in entry['Inventory'] })
|
self.state['Cargo'].update({ self.canonicalise(x['Name']): x['Count'] for x in entry['Inventory'] })
|
||||||
elif entry['event'] in ['CollectCargo', 'MarketBuy', 'BuyDrones', 'MiningRefined']:
|
elif entry['event'] in ['CollectCargo', 'MarketBuy', 'BuyDrones', 'MiningRefined']:
|
||||||
commodity = self.canonicalise(entry['Type'])
|
commodity = self.canonicalise(entry['Type'])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user