timewarrior/ext/csv.py
2017-03-01 21:20:35 +01:00

27 lines
482 B
Python
Executable file

#!/usr/bin/env python
import sys
import json
# Skip the configuration settings.
for line in sys.stdin:
if line == '\n':
break;
# Extract the JSON.
doc = ''
for line in sys.stdin:
doc += line
total_active_time = 0
j = json.loads(doc)
for object in j:
line = '"%s",' % object['start']
line +='"%s"' % (object['end'] if 'end' in object else '')
if 'tags' in object:
for tag in object['tags']:
line += ',"%s"' % tag
print line