]> projects.mako.cc - iron-blogger/commitdiff
Script to post the weekly blog post
authorNelson Elhage <nelhage@mit.edu>
Tue, 2 Feb 2010 03:07:26 +0000 (22:07 -0500)
committerNelson Elhage <nelhage@mit.edu>
Tue, 2 Feb 2010 03:07:26 +0000 (22:07 -0500)
templates/week.tmpl
weekly-update.py [new file with mode: 0755]

index 95ff25664ee556630909ed724b8f6b3e8c557048..68f6474dc3c00469ed99bee8d516e941aba79683 100644 (file)
@@ -1,3 +1,4 @@
+Results for week beginning ${week_start.strftime("%F")}
 <h2>People who posted</h2>
 <ul>
 % for u in sorted(good, key=lambda u:u.username):
 <h2>People who posted</h2>
 <ul>
 % for u in sorted(good, key=lambda u:u.username):
diff --git a/weekly-update.py b/weekly-update.py
new file mode 100755 (executable)
index 0000000..c513a14
--- /dev/null
@@ -0,0 +1,30 @@
+#!/usr/bin/python
+import render
+import os
+import sys
+import xmlrpclib
+import subprocess
+
+XMLRPC_ENDPOINT = 'http://iron-blogger.mit.edu/xmlrpc.php'
+USER            = 'nelhage'
+BLOG_ID         = 1
+
+try:
+    subprocess.call(['stty', '-echo'])
+    passwd = raw_input("Password for %s: " % (USER,))
+    print
+finally:
+    subprocess.call(['stty', 'echo'])
+
+x = xmlrpclib.ServerProxy(XMLRPC_ENDPOINT)
+
+text = render.render_template('templates/week.tmpl', sys.argv[1])
+
+lines = text.split("\n")
+title = lines[0]
+body  = "\n".join(lines[1:])
+
+page = dict(title = title,
+            description = body)
+
+x.metaWeblog.newPost(BLOG_ID, USER, passwd, page, True)

Benjamin Mako Hill || Want to submit a patch?