10 XMLRPC_ENDPOINT = 'http://iron-blogger.mako.cc/xmlrpc.php'
22 today = str(datetime.date.today())
24 with open('ledger', 'a') as f:
26 f.write(render.render_template('templates/ledger', date))
29 subprocess.check_call(["git", "commit", "ledger",
30 "-m", "Update for %s" % (date,)])
32 debts = render.get_debts()
35 with open('ledger', 'a') as f:
37 for (user, debt) in debts:
38 if debt < 30: continue
42 Pool:Owed:%(user)s $-%(debt)s
44 """ % {'user': user, 'debt': debt, 'today': today})
48 text = render.render_template('templates/week.tmpl', date, punt=punt)
50 lines = text.split("\n")
52 body = "\n".join(lines[1:])
54 page = dict(title = title, description = body)
57 subprocess.call(['stty', '-echo'])
58 passwd = raw_input("Password for %s: " % (USER,))
61 subprocess.call(['stty', 'echo'])
63 x = xmlrpclib.ServerProxy(XMLRPC_ENDPOINT)
64 x.metaWeblog.newPost(BLOG_ID, USER, passwd, page, True)
66 email = render.render_template('templates/email.txt', date, punt=punt)
71 p = subprocess.Popen(['mutt', '-H', '/dev/stdin'],
72 stdin=subprocess.PIPE)
76 with open('bloggers.yml') as b:
77 bloggers = yaml.safe_load(b)
79 if 'end' not in bloggers[p]:
80 bloggers[p]['end'] = date
81 with open('bloggers.yml','w') as b:
82 yaml.safe_dump(bloggers, b)
85 subprocess.check_call(["git", "commit", "ledger", "bloggers.yml",
86 "-m", "Punts for %s" % (date,)])
88 # if it's a dry run, lets set the ledger back to the beginning state
90 subprocess.check_call(["git", "checkout", "ledger"])
93 subprocess.check_call(["git", "checkout", "bloggers.yml"])