--- /dev/null
+#!/usr/bin/python
+
+# UCC Minutes Arse (RSS) generator
+
+import subprocess
+import shlex
+import os
+import time
+from cgi import escape
+import sys
+
+MINUTESURL = 'http://www.ucc.asn.au/infobase/minutes/'
+MINUTESPATH = '/services/http/infobase/minutes/'
+
+def RFCTime(pubtime):
+ return time.strftime("%a, %d %b %Y %H:%M:%S +0800", pubtime)
+
+class UCCMinutes:
+ '''Loads relevant information out of UCC minutes'''
+ def __init__(self, path):
+ if os.path.exists(path):
+ self.stattime = os.stat(path)[-2]
+ self.modtime = RFCTime(time.localtime(self.stattime))
+ f = open(path,'r')
+ self.body = escape(f.read())
+ f.close()
+
+ self.title = self.body.split('\n')[0].strip()
+
+ webpath = path.split('/')[-2:]
+ self.url = MINUTESURL + '/'.join(webpath)
+
+def RSS(items,pubtime=''):
+ pubtime = pubtime or RFCTime(time.localtime())
+ output = '''<?xml version='1.0' encoding='utf-8' ?>
+<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
+<channel>
+ <atom:link href="http://www.ucc.asn.au/infobase/minutes/minutes.xml" rel="self" type="application/rss+xml" />
+ <title>UCC Meeting Minutes</title>
+ <link>http://www.ucc.asn.au/infobase/minutes/</link>
+ <description>Meeting Minutes of the University Computer Club</description>
+'''
+ output += ' <lastBuildDate>%s</lastBuildDate>\n'%pubtime
+ output += ''' <generator>The giant hack that is Python by JCF</generator>
+
+'''
+ output += items
+ output += '</channel>\n</rss>'
+
+ return output
+
+def itemWriter(minutes):
+ output = '<item>\n'
+ output += '<guid>%s</guid>\n'%minutes.url
+ output += '<title>%s</title>\n'%minutes.title
+ output += '<pubDate>%s</pubDate>\n'%minutes.modtime
+ output += '<link>%s</link>\n'%minutes.url
+ output += '<description><![CDATA[<pre>%s</pre>]]></description>\n'%minutes.body
+ output += '</item>\n'
+ return output
+
+# BEWARE THE GIANT HACK - This should be replaced before it burns someone
+args = shlex.split('/usr/bin/find %s'%MINUTESPATH + ' -maxdepth 2 -iname "*txt" -type f -printf "%TY-%Tm-%Td %TT %p\n"')
+sub = subprocess.Popen(args, stdout=subprocess.PIPE)
+items = sub.communicate()[0].split('\n')
+items.sort()
+
+items = [os.path.abspath(x.split(' ')[-1]) for x in items[-15:]]
+items.reverse()
+
+minutes = [UCCMinutes(x) for x in items]
+
+print RSS(''.join([itemWriter(x) for x in minutes]), minutes[0].modtime)