Skip to content

Commit

Permalink
Changing to JSON output
Browse files Browse the repository at this point in the history
  • Loading branch information
mtlynch committed Oct 26, 2018
1 parent 087c67a commit 79df12a
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions main.py
@@ -1,10 +1,11 @@
#!/usr/bin/python2

import argparse
import json
import os
import logging

from chat_unifier import debug_print
from chat_unifier import json_serializer
from chat_unifier import history_merger
from chat_unifier.parsers.trillian import parser as trillian_parser

Expand All @@ -30,13 +31,17 @@ def main(args):
for filename in os.listdir(log_dir):
if not filename.endswith('xml'):
continue
if filename.endswith('-assets.xml'):
continue
full_path = os.path.join(log_dir, filename)
with open(full_path) as log_handle:
parser = trillian_parser.Parser()
merger.add(parser.parse(log_handle.read()))
logger.info('Parsed %s', filename)
for history in merger:
debug_print.print_history(history)
print json.dumps([h for h in merger],
indent=2,
sort_keys=True,
cls=json_serializer.Serializer)


if __name__ == '__main__':
Expand Down

0 comments on commit 79df12a

Please sign in to comment.