#!/usr/bin/python
#author: Bryan Bishop <kanzure@gmail.com>
#date: 2010-03-16
from datetime import datetime
strptime = datetime.strptime

logs = open("../irclogs.txt", "r").read().split("\n")

current = open("initial.log", "w")
for line in logs:
    if line[0:16] == "--- Day changed ":
        date = line[16:]
        parsed_date = strptime(date, "%a %b %d %Y")

        current.close()
        current = open(parsed_date.strftime("%Y-%m-%d") + ".log", "w")
        current.write(line + "\n")
    else:
        current.write(line + "\n")
current.close()


