<gh_stars>0
#!/usr/bin/env python3
import sys
from timewreport.parser import TimeWarriorParser

parser = TimeWarriorParser(sys.stdin)

for interval in parser.get_intervals():
    line = '"{}"'.format(interval.get_start())
    line += ',"{}"'.format(interval.get_end()) if not interval.is_open() else ''
    line += ',"{}"'.format(interval.get_duration().seconds)

    for tag in interval.get_tags():
        line += ',"{}"'.format(tag)

    print(line)
