From 1349b2bca159d1dc959c14b3d9832076d6680b40 Mon Sep 17 00:00:00 2001 From: Athanasius Date: Wed, 1 Jun 2022 16:24:51 +0100 Subject: [PATCH] eddn: codexentry: Ody Update 12 will add BodyID * So add a check to see if the event already has it, and leave it if so. * And might as well have a check on BodyName in case that gets added as well. --- plugins/eddn.py | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/plugins/eddn.py b/plugins/eddn.py index 8db26469..c934f6d7 100644 --- a/plugins/eddn.py +++ b/plugins/eddn.py @@ -976,15 +976,20 @@ class EDDN: f' "{this.status_body_name}" ({type(this.status_body_name)})') else: - entry['BodyName'] = this.status_body_name - # Only set BodyID if journal BodyName matches the Status.json one. - # This avoids binary body issues. - if this.status_body_name == this.body_name: - if this.body_id is not None and isinstance(this.body_id, int): - entry['BodyID'] = this.body_id + # In case Frontier add it in + if entry.get('BodyName', None) is None: + entry['BodyName'] = this.status_body_name - else: - logger.warning(f'this.body_id was not set properly: "{this.body_id}" ({type(this.body_id)})') + # Frontier are adding this in Odyssey Update 12 + if entry.get('BodyID', None) is None: + # Only set BodyID if journal BodyName matches the Status.json one. + # This avoids binary body issues. + if this.status_body_name == this.body_name: + if this.body_id is not None and isinstance(this.body_id, int): + entry['BodyID'] = this.body_id + + else: + logger.warning(f'this.body_id was not set properly: "{this.body_id}" ({type(this.body_id)})') ####################################################################### # Check just the top-level strings with minLength=1 in the schema