Addition of new features++, read ChangeLog
authordavyd <davyd>
Mon, 22 Mar 2004 06:06:17 +0000 (06:06 +0000)
committerdavyd <davyd>
Mon, 22 Mar 2004 06:06:17 +0000 (06:06 +0000)
13 files changed:
Changelog
FOAFWriter.py [new file with mode: 0644]
OPMLWriter.py [new file with mode: 0644]
RSS1Writer.py
RSS2Writer.py
XHTMLWriter.py
XMLParse2.py
XMLWriter.py
faq.html
launch-update-planet.sh
planet.css
sidebar.html
update-planet

index 8b94210..3d91b86 100644 (file)
--- a/Changelog
+++ b/Changelog
@@ -1,3 +1,27 @@
+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
diff --git a/FOAFWriter.py b/FOAFWriter.py
new file mode 100644 (file)
index 0000000..39ff3fe
--- /dev/null
@@ -0,0 +1,52 @@
+#
+# 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.
+#
+# (c) 2004, Davyd Madeley <[email protected]>
+#
+
+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
diff --git a/OPMLWriter.py b/OPMLWriter.py
new file mode 100644 (file)
index 0000000..c7bca14
--- /dev/null
@@ -0,0 +1,33 @@
+#
+# OPMPWriter
+#
+# A plugin to XMLWriter to output OPML
+#
+# This is apparently the most horrific abuse of XML known to man.
+#
+# (c) 2004, Davyd Madeley <[email protected]>
+#
+
+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  +=      '  <ownerEmail>[email protected]</ownerEmail>\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
index 7d7ce17..9609e74 100644 (file)
@@ -17,7 +17,7 @@ class RSS1Writer:
        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)
index f61d315..cd19d11 100644 (file)
@@ -17,7 +17,7 @@ class RSS2Writer:
        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)
index 3ef84c9..93aa9de 100644 (file)
@@ -17,11 +17,12 @@ class XHTMLWriter:
        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
@@ -62,7 +63,7 @@ class XHTMLWriter:
                        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'
@@ -89,7 +90,7 @@ class XHTMLWriter:
                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
index 3a14e2b..861b333 100644 (file)
@@ -17,6 +17,7 @@ feedparser.USER_AGENT = "PlanetUCC/1.0b +http://planet.ucc.asn.au/ %s" % feedpar
 
 class Blog:
        def __init__(self):
+               self.blogName   = None
                self.blogTitle  = None
                self.blogURL    = None
                self.feedURL    = None
index 7f60c4e..a4bca9d 100644 (file)
@@ -14,6 +14,7 @@ class PlanetItem:
                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
index 887552b..0350e70 100644 (file)
--- a/faq.html
+++ b/faq.html
@@ -23,7 +23,7 @@
    <p>
 
     <!-- Remember to change this -->
-    Monday February 09, 2004 12:12 AWST
+    Monday March 20, 2004 01:20 AWST
    </p>
   </div>
 
@@ -63,8 +63,9 @@
        </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>
    
index 284a42e..4687fa2 100755 (executable)
@@ -13,6 +13,6 @@ cd $HOME/projects/planetucc/
 EXITSTATUS=$?
 if [ $EXITSTATUS -eq 0 ]; then
        scp planet.html [email protected]:public-html/index.html
-       scp rss[12].xml [email protected]:public-html/
+       scp {rss1,rss2,foaf,opml}.xml [email protected]:public-html/
 fi
 cd $OLDPWD
index 293f861..ea0c89d 100644 (file)
        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;
index a05da67..e29615c 100644 (file)
 <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>
index c4477ff..4e23e5b 100755 (executable)
@@ -12,7 +12,7 @@ import sys, codecs
 # 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()
@@ -34,7 +34,7 @@ for feed in feeds:
        # 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
@@ -67,3 +67,14 @@ try:
        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

UCC git Repository :: git.ucc.asn.au