10 XMLRPC_ENDPOINT = 'http://iron-blogger.mako.cc/xmlrpc.php'
23 with open('ledger', 'a') as f:
25 f.write(render.render_template('templates/ledger', date))
28 subprocess.check_call(["git", "commit", "ledger",
29 "-m", "Update for %s" % (date,)])
31 debts = render.get_debts()
34 with open('ledger', 'a') as f:
36 for (user, debt) in debts:
37 if debt < 30: continue
41 Pool:Owed:%(user)s $-%(debt)s
43 """ % {'user': user, 'debt': debt, 'date': date})
47 text = render.render_template('templates/week.tmpl', date, punt=punt)
49 lines = text.split("\n")
51 body = "\n".join(lines[1:])
53 page = dict(title = title, description = body)
56 subprocess.call(['stty', '-echo'])
57 passwd = raw_input("Password for %s: " % (USER,))
60 subprocess.call(['stty', 'echo'])
62 x = xmlrpclib.ServerProxy(XMLRPC_ENDPOINT)
63 x.metaWeblog.newPost(BLOG_ID, USER, passwd, page, True)
65 email = render.render_template('templates/email.txt', date, punt=punt)
70 p = subprocess.Popen(['mutt', '-H', '/dev/stdin'],
71 stdin=subprocess.PIPE)
75 with open('bloggers.yml') as b:
76 bloggers = yaml.safe_load(b)
78 if 'end' not in bloggers[p]:
79 bloggers[p]['end'] = date
80 with open('bloggers.yml','w') as b:
81 yaml.safe_dump(bloggers, b)
84 subprocess.check_call(["git", "commit", "ledger", "bloggers.yml",
85 "-m", "Punts for %s" % (date,)])
87 # if it's a dry run, lets set the ledger back to the beginning state
89 subprocess.check_call(["git", "checkout", "ledger"])
92 subprocess.check_call(["git", "checkout", "bloggers.yml"])