+2004-03-20
+==========
+ * update-planet, XMLWriter.py, XHTMLWriter.py, RSS1Writer.py, RSS2Writer.py,
+ XMLParse2.py
+ Stopped overwriting .blogTitle, adding a field .blogName to store the name
+ of the syndicated blogger.
+ * XHTMLWriter.py, planet.css
+ Added (heavily modified code) from [TRS] to make it show the name of the
+ blog when you hover over the name of the person. The name of the blogger,
+ and name of the article are now linked (this is not obvious after changes
+ to planet.css).
+ * Added FOAFWriter.py
+ A plugin to XMLWriter to do FOAF (Friend Of A Friend) XML feeds. FOAF
+ actually seems quite complex in what it can tell you, however the FOAF
+ feeds from the Planets is quite simplistic. This should suffice [YAK].
+ * Added OPMLWriter.py
+ A plugin to XMLWriter to do OPML.
+ * update-planet, launch-update-planet.sh
+ FOAF and OPML support.
+ * sidebar.html
+ Mentions of new syndication.
+ * faq.html
+ Fixed annoying mistakes. Should really write an FAQ.
+
2004-03-15
==========
* update-planet
--- /dev/null
+#
+# FOAFWriter
+#
+# A plugin to XMLWriter to output FOAF (friend of a friend).
+#
+# I have a quick look through some sample FOAF, it seems it
+# can get quite intricate in things it can tell you, however
+# other Planets only offer this basic feed. Given this is almost
+# all the information we know, that can't be too bad.
+#
+#
+
+class FOAFWriter:
+ def __init__(self, planet):
+ self.parent = None
+
+ def __write_item__(self, blog):
+ output = ''
+ output += '<foaf:member>\n'
+ output += ' <foaf:Agent>\n'
+ output += ' <foaf:name>%s</foaf:name>\n' % blog.blogName
+ output += ' <foaf:weblog>\n'
+ output += ' <foaf:Document rdf:about="%s" />\n' % blog.blogURL
+ output += ' <dc:title>%s</dc:title>\n' % blog.blogTitle
+ output += ' <rdfs:seeAlso>\n'
+ output += ' <rss:channel rdf:about="%s" />\n' % blog.feedURL
+ output += ' </rdfs:seeAlso>\n'
+ output += ' </foaf:Document>\n'
+ output += ' </foaf:weblog>\n'
+ output += ' </foaf:Agent>\n'
+ output += '</foaf:member>\n'
+ return output
+
+ def write(self):
+ itemcount = 0
+ output = ''
+ output += '<rdf:RDF>\n'
+ output += ' xmlns="http://purl.org/rss/1.0/"\n'
+ output += ' xmlns:dc="http://purl.org/dc/elements/1.1/"\n'
+ output += ' xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">\n'
+ # XXX: probably need other doctypes here
+ # infact, need to check XML structures
+ output += ' <foaf:Group>\n'
+ output += ' <foaf:name>Planet UCC</foaf:name>\n'
+ output += ' <foaf:homepage>http://planet.ucc.asn.au/</foaf:homepage>\n'
+ output += ' <rdfs:seeAlso rdf:resource="http://planet.ucc.asn.au/foaf.xml" />\n'
+ for blog in self.parent.blogs:
+ output += self.__write_item__(blog)
+ output += ' </foaf:Group>\n'
+ output += '</rdf:RDF>'
+ return output
--- /dev/null
+#
+# OPMPWriter
+#
+# A plugin to XMLWriter to output OPML
+#
+# This is apparently the most horrific abuse of XML known to man.
+#
+#
+
+import time
+
+class OPMLWriter:
+ def __init__(self, planet):
+ self.parent = None
+
+ def write(self):
+ output = ''
+ output += '<opml version="1.1">\n'
+ output += ' <head>\n'
+ output += ' <title>Planet UCC</title>\n'
+ date = time.strftime("%a, %d %b %Y %H:%M:%S +0800", time.localtime())
+ output += ' <dateCreated>%s</dateCreated>\n' % date
+ output += ' <dateModified>%s</dateModified>\n' % date
+ output += ' <ownerName>Planetmaster</ownerName>\n'
+ output += ' </head>\n'
+ output += ' <body>\n'
+ for blog in self.parent.blogs:
+ output += ' <outline text="%s" xmlURL="%s" />\n' % (blog.blogName, blog.feedURL)
+ output += ' </body>\n'
+ output += '</opml>'
+ return output
def __write_item__(self, item):
output = ''
output += '<item rdfAbout="%s">\n' % item.itemURL
- output += ' <title>%s: %s</title>\n' % (item.blogTitle, item.itemTitle)
+ output += ' <title>%s: %s</title>\n' % (item.blogName, item.itemTitle)
output += ' <link>%s</link>\n' % item.itemURL
output += ' <description>\n'
output += cgi.escape(item.contents)
def __write_item__(self, item):
output = ''
output += '<item>\n'
- output += ' <title>%s: %s</title>\n' % (item.blogTitle, item.itemTitle)
+ output += ' <title>%s: %s</title>\n' % (item.blogName, item.itemTitle)
output += ' <link>%s</link>\n' % item.itemURL
output += ' <description>\n'
output += cgi.escape(item.contents)
def __write_item__(self, item):
output = ''
output += '<div class="item">\n'
- output += '<h2>%s: %s</h2>\n' % (item.blogTitle, item.itemTitle)
+ output += '<h2><a href="%s" title="%s">%s</a>: <a href="%s">%s</a></h2>\n' % (item.blogURL, item.blogTitle, item.blogName,
+ item.itemURL, item.itemTitle)
output += '<p class="time">\n'
if item.imageURL:
- output += '<a class="image" href="%s"><img class="image" src="%s" alt="%s" /></a>\n' % (item.imageLink, item.imageURL, item.blogTitle)
- output += '(<a href="%s">%s</a>)\n' % (item.itemURL ,time.strftime('%A %B %d, %Y %H:%M AWST', time.localtime(item.itemDate)))
+ output += '<a class="image" href="%s"><img class="image" src="%s" alt="%s" /></a>\n' % (item.imageLink, item.imageURL, item.blogName)
+ output += '(<a href="%s">%s</a>)\n' % (item.itemURL ,time.strftime('posted on %A %B %d, %Y at %H:%M AWST', time.localtime(item.itemDate)))
output += '</p>\n'
output += '<p class="body">\n'
output += item.contents
blogscopy = self.parent.blogs + []
blogscopy.sort(self.__blog_sort__)
for blog in blogscopy:
- output += '<a href="%s">%s</a> (<a href="%s">feed</a>)<br />\n' % (blog.blogURL, blog.blogTitle, blog.feedURL)
+ output += '<a href="%s">%s</a> (<a href="%s">feed</a>)<br />\n' % (blog.blogURL, blog.blogName, blog.feedURL)
output += '</p>\n'
output += '</div>\n'
output += '<div class="items">\n'
return output
def __blog_sort__(self, blog1, blog2):
- name1, name2 = blog1.blogTitle.split(' ')[-1], blog2.blogTitle.split(' ')[-1]
+ name1, name2 = blog1.blogName.split(' ')[-1], blog2.blogName.split(' ')[-1]
if name1 < name2: return -1
if name1 == name2: return 0
if name1 > name2: return 1
class Blog:
def __init__(self):
+ self.blogName = None
self.blogTitle = None
self.blogURL = None
self.feedURL = None
self.itemURL = item.itemURL
self.itemDate = item.itemDate
self.blogTitle = blog.blogTitle
+ self.blogName = blog.blogName
self.blogURL = blog.blogURL
self.imageURL = blog.imageURL
self.imageLink = blog.imageLink
<p>
<!-- Remember to change this -->
- Monday February 09, 2004 12:12 AWST
+ Monday March 20, 2004 01:20 AWST
</p>
</div>
</p>
<ul>
<li><a href="http://planet.gnome.org/">Planet GNOME</a></li>
- <li><a href="http://planet.debian.org/">Planet Debian</a></li>
+ <li><a href="http://planet.debian.net/">Planet Debian</a></li>
<li><a href="http://people.novell.com/pn/">Planet Novell</a> (offline)</li>
+ <li><a href="http://planet.freedesktop.org/">Planet FreeDesktop.org</a></li>
</ul>
</div>
EXITSTATUS=$?
if [ $EXITSTATUS -eq 0 ]; then
fi
cd $OLDPWD
padding: 0.5ex;
}
+.item h2 a {
+ text-decoration: none;
+ color: black;
+}
+.item h2 a:visited {
+ text-decoration: none;
+ color: black;
+}
+
.item img {
border-style: none;
padding-left: 1ex;
<h2>Syndication</h2>
<p>
Planet UCC offers
- <a href="rss1.xml">RSS 1.0</a>, and
- <a href="rss2.xml">RSS 2.0</a>
+ <a href="rss1.xml">RSS 1.0</a>,
+ <a href="rss2.xml">RSS 2.0</a>,
+ <a href="foaf.xml">FOAF</a>, and
+ <a href="opml.xml">OPML</a>
feeds of this webpage.
</p>
<h2>Links</h2>
# planetUCC modules
import XMLParse2 as XMLParse, XMLWriter, CacheHandler
# planetUCC output plugins
-import XHTMLWriter, RSS2Writer, RSS1Writer
+import XHTMLWriter, RSS2Writer, RSS1Writer, FOAFWriter, OPMLWriter
# step 1: read in the config and check each object from cache
cache = CacheHandler.CacheHandler()
# XMLParse2 takes two paramaters, a URL and a CacheObject
blog = XMLParse.XMLParse(feed[1], feed[2]).parse()
if blog:
- blog.blogTitle = feed[0]
+ blog.blogName = feed[0]
blog.feedURL = feed[1]
blogs.append(blog)
# check the old copy of the cache, vs the new copy
codecs.open('rss1.xml', 'wb', 'utf-8').write(xmlwriter.write(RSS1Writer.RSS1Writer))
except:
sys.stderr.write('DEBUG: update-planet: could not write rss1.xml, aborting\n')
+
+try:
+ codecs.open('foaf.xml', 'wb', 'utf-8').write(xmlwriter.write(FOAFWriter.FOAFWriter))
+except:
+ sys.stderr.write('DEBUG: update-planet: could not write foaf.xml, aborting\n')
+
+try:
+ codecs.open('opml.xml', 'wb', 'utf-8').write(xmlwriter.write(OPMLWriter.OPMLWriter))
+except:
+ sys.stderr.write('DEBUG: update-planet: could not write opml.xml, aborting\n')
+ raise