1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-17 01:22:19 +03:00

Don't auto update System while in CQC.

This commit is contained in:
Jonathan Harris 2016-01-11 18:59:29 +00:00
parent 5a63f3172c
commit 31d1f02043

View File

@ -182,6 +182,9 @@ class EDLogs(FileSystemEventHandler):
# e.g. "{18:11:44} System:22(Gamma Doradus) Body:3 Pos:(3.69928e+07,1.13173e+09,-1.75892e+08) \r\n" or "... NormalFlight\r\n" or "... Supercruise\r\n"
# Note that system name may contain parantheses, e.g. "Pipe (stem) Sector PI-T c3-5".
regexp = re.compile(r'\{(.+)\} System:\d+\((.+)\) Body:')
regexp_cqc = re.compile(r'\{.+\} \[PG\] (.+)')
cqc = False
# Seek to the end of the latest log file
logfile = self.logfile
@ -199,15 +202,23 @@ class EDLogs(FileSystemEventHandler):
if loghandle:
loghandle.close()
loghandle = open(logfile, 'rt')
cqc = False
if logfile:
system = visited = None
loghandle.seek(0, 1) # reset EOF flag
for line in loghandle:
match = regexp.match(line)
match = regexp_cqc.match(line)
if match:
system, visited = match.group(2), match.group(1)
if 'Joined a gameplay lobby' in match.group(1) or 'Created playlist lobby' in match.group(1) or 'Found matchmaking lobby object' in match.group(1):
cqc = True
elif 'Left a playlist lobby' in match.group(1) or 'Destroying playlist lobby' in match.group(1):
cqc = False
elif not cqc:
match = regexp.match(line)
if match:
system, visited = match.group(2), match.group(1)
if system:
self._restart_required = False # clearly logging is working