This commit is contained in:
Gabor Körber 2017-04-14 18:49:21 +02:00
parent 1c70be079e
commit 5cc8f5d893
2 changed files with 12 additions and 2 deletions

View File

@ -141,4 +141,4 @@ class LogStream(object):
def resolve(self, gd):
# gd is a dict.
# try to find a class that is responsible for this log.
return gd
return gd

View File

@ -15,7 +15,8 @@ class LogSession(object):
class LogFileSession(LogSession):
"""
The Log-File-Session is supposed to save one directory of logs.
It can parse its logs, and build up its internal structure into Battle Instances etc.
It can parse its logs, and should become able to build up its internal
structure into Battle Instances etc.
"""
VALID_FILES = ['combat.log', 'game.log', 'chat.log' ] # extend this to other logs.
@ -147,6 +148,15 @@ class LogFileSession(LogSession):
return found
class LogSessionCollector(object):
"""
finds sessions in a directory, a.k.a. you load the log directories
of SC into sessions.
- find_sessions: only find and instantiate sessions.
- collect: validates each found session and returns them as list.
- collect_unique: instead of a list, a dict is returned, where each
session can be accessed via its idstr. does not parse/validate sessions.
"""
def __init__(self, directory):
self.initial_directory = directory
self.sessions = []