def _generate_intervals(self):
""" Export TimeWarrior data as JSON and calculate bins. """
assert len(self.time_span.split(' ')) >= 1
if len(self.time_span.split(' ')) == 1:
command = [':{d}'.format(d=self.time_span)]
elif len(self.time_span.split(' ')) > 1:
command = self.time_span.split(' ')
process = subprocess.Popen(
['timew', 'export'] + command + [self.tag],
stdout=subprocess.PIPE
)
out, err = process.communicate()
intervals = json.loads(out.decode('utf8').replace('\n', ''))
if intervals and (not intervals[-1].get('end')):
del intervals[-1]
return intervals
评论列表
文章目录