]> projects.mako.cc - iron-blogger/blob - show-week.py
Script to print the results for a given week
[iron-blogger] / show-week.py
1 import yaml
2 from dateutil.parser import parse
3 import datetime
4 import dateutil.tz as tz
5 import sys
6
7 START = datetime.datetime(2009, 12, 21, 6)
8
9 with open('report.yml') as r:
10     report = yaml.safe_load(r)
11
12 with open('bloggers.yml') as f:
13     users = yaml.safe_load(f)
14
15 week = (parse(sys.argv[1], default=START) - START).days / 7
16 week_start = START + (week * datetime.timedelta(7))
17 week_end   = START + ((week + 1) * datetime.timedelta(7))
18
19
20 for (name, weeks) in report.items():
21     user_start = parse(users[name]['start'], default=START)
22     if user_start > week_start:
23         print "SKIP %s" % (name,)
24         continue
25     elif len(weeks) <= week or not weeks[week]:
26         print "LAME %s" % (name,)
27     else:
28         print "OK %s" % (name,)

Benjamin Mako Hill || Want to submit a patch?