From f9034076d88a17468de5d5df9ee69b5d39da50b1 Mon Sep 17 00:00:00 2001 From: Athanasius Date: Tue, 23 Mar 2021 12:37:05 +0000 Subject: [PATCH 1/3] Extra paranoia about game version for forthcoming Odyssey Alpha 1. Pick up 'JournalAlpha' files if they ever are a thing. 2. Pick up 'alpha' in gameversion to set is_beta = True. 3. For now any gameversion without 'Fleet Carriers Update' is considered a beta. --- monitor.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/monitor.py b/monitor.py index 19d35aae..4050fc63 100644 --- a/monitor.py +++ b/monitor.py @@ -58,7 +58,7 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below _POLL = 1 # Polling is cheap, so do it often _RE_CANONICALISE = re.compile(r'\$(.+)_name;') _RE_CATEGORY = re.compile(r'\$MICRORESOURCE_CATEGORY_(.+);') - _RE_LOGFILE = re.compile(r'^Journal(Beta)?\.[0-9]{12}\.[0-9]{2}\.log$') + _RE_LOGFILE = re.compile(r'^Journal(Alpha|Beta)?\.[0-9]{12}\.[0-9]{2}\.log$') def __init__(self): # TODO(A_D): A bunch of these should be switched to default values (eg '' for strings) and no longer be Optional @@ -382,7 +382,12 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below if event_type == 'Fileheader': self.live = False self.version = entry['gameversion'] - self.is_beta = 'beta' in entry['gameversion'].lower() + self.is_beta = any(v in entry['gameversion'].lower() for v in ('alpha', 'beta')) + + # TODO: This is an extra paranoia check, because we don't yet know what will (not) be in the Odyssey alpha string. + if ('Fleet Carriers Update' not in entry['gameversion']): + self.is_beta = True + self.cmdr = None self.mode = None self.group = None From c722a1cada55340b1397a6be4dd39c165b70edef Mon Sep 17 00:00:00 2001 From: Athanasius Date: Tue, 23 Mar 2021 12:40:28 +0000 Subject: [PATCH 2/3] Extra paranoia: Don't pick up 'JournalAlpha...' for now It's possible FDev will use JournalAlpha, but forget to change the gameversion string. --- monitor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/monitor.py b/monitor.py index 4050fc63..d0e7b08d 100644 --- a/monitor.py +++ b/monitor.py @@ -58,7 +58,7 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below _POLL = 1 # Polling is cheap, so do it often _RE_CANONICALISE = re.compile(r'\$(.+)_name;') _RE_CATEGORY = re.compile(r'\$MICRORESOURCE_CATEGORY_(.+);') - _RE_LOGFILE = re.compile(r'^Journal(Alpha|Beta)?\.[0-9]{12}\.[0-9]{2}\.log$') + _RE_LOGFILE = re.compile(r'^Journal(Beta)?\.[0-9]{12}\.[0-9]{2}\.log$') def __init__(self): # TODO(A_D): A bunch of these should be switched to default values (eg '' for strings) and no longer be Optional From 83f8f4f54795487358adf0f783f6f9ba2eae93cf Mon Sep 17 00:00:00 2001 From: Athanasius Date: Tue, 23 Mar 2021 12:44:12 +0000 Subject: [PATCH 3/3] Clean up "not Fleet Carriers" gameversion check 1. No need for the () on the if. 2. Log when we force is_beta = True from this. --- monitor.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/monitor.py b/monitor.py index d0e7b08d..55c9ebea 100644 --- a/monitor.py +++ b/monitor.py @@ -385,7 +385,8 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below self.is_beta = any(v in entry['gameversion'].lower() for v in ('alpha', 'beta')) # TODO: This is an extra paranoia check, because we don't yet know what will (not) be in the Odyssey alpha string. - if ('Fleet Carriers Update' not in entry['gameversion']): + if 'Fleet Carriers Update' not in entry['gameversion']: + logger.warning(f'Forcing is_beta to True due to gameversion: {entry["gameversion"]}') self.is_beta = True self.cmdr = None