Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/meeting.py
diff options
context:
space:
mode:
authorRichard Darst <rkd@zgib.net>2009-09-11 01:16:46 (GMT)
committer Richard Darst <rkd@zgib.net>2009-09-11 01:16:46 (GMT)
commit78d7365a6ebd63268941ffd2ae0a3d9dbb725d41 (patch)
tree65182e428e38e7ce573f58af8ba1c0ac7b2238a9 /meeting.py
parent88141efa3e1d6f2ea4314463bc2246891440fca8 (diff)
Add process_meeting function to replay a meeting
- The process_meeting method takes the contents of a file, runs it through the Meeting object, and returns the resulting Meeting object. This is useful for doing tests - the Meeting object can be analyzed to make sure the meeting performed as expected. darcs-hash:20090911011646-82ea9-59cea8a934d082d45bf45585b798eac9a430ed59.gz
Diffstat (limited to 'meeting.py')
-rw-r--r--meeting.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/meeting.py b/meeting.py
index b08c469..a99e740 100644
--- a/meeting.py
+++ b/meeting.py
@@ -535,6 +535,36 @@ logline_re = re.compile(r'\[?([0-9: ]*)\]? *<[@+]?([^>]+)> *(.*)')
loglineAction_re = re.compile(r'\[?([0-9: ]*)\]? *\* *([^ ]+) *(.*)')
+def process_meeting(contents, channel, filename,
+ extraConfig = {},
+ dontSave=False,
+ safeMode=True):
+ M = Meeting(channel=channel, owner=None,
+ filename=filename, writeRawLog=False, safeMode=safeMode)
+ if dontSave:
+ M.config.dontSave = True
+ # Update config values with anything we may have
+ for k,v in extraConfig.iteritems():
+ setattr(M.config, k, v)
+ # process all lines
+ for line in contents.split('\n'):
+ # match regular spoken lines:
+ m = logline_re.match(line)
+ if m:
+ time_ = parse_time(m.group(1).strip())
+ nick = m.group(2).strip()
+ line = m.group(3).strip()
+ if M.owner is None:
+ M.owner = nick ; M.chairs = {nick:True}
+ M.addline(nick, line, time_=time_)
+ # match /me lines
+ m = loglineAction_re.match(line)
+ if m:
+ time_ = parse_time(m.group(1).strip())
+ nick = m.group(2).strip()
+ line = m.group(3).strip()
+ M.addline(nick, "ACTION "+line, time_=time_)
+ return M
# None of this is very well refined.
if __name__ == '__main__':