From a4faa68ff5b4b2fd83a63aa16ab8572f8d9d7cf3 Mon Sep 17 00:00:00 2001 From: davyd Date: Fri, 26 Nov 2004 04:00:05 +0000 Subject: [PATCH] Committed at the Behesh of Frenchie, I haven't been keeping a good changelog --- RSS2Writer.py | 1 + XHTMLWriter.py | 8 +++++++- XMLParse2.py | 12 ++++++++++-- XMLWriter.py | 1 + feedlist | 5 +++-- sidebar.html | 19 +++++++++---------- update-planet | 3 ++- 7 files changed, 33 insertions(+), 16 deletions(-) diff --git a/RSS2Writer.py b/RSS2Writer.py index cd19d11..2a6ee02 100644 --- a/RSS2Writer.py +++ b/RSS2Writer.py @@ -23,6 +23,7 @@ class RSS2Writer: output += cgi.escape(item.contents) output += '\n \n' output += '%s\n' % time.strftime('%a, %d %b %Y %H:%M:%S +0800', time.gmtime(item.itemDate)) + output += '%s\n' % item.commentsURL output += '\n' return output diff --git a/XHTMLWriter.py b/XHTMLWriter.py index 99300ba..caa01f3 100644 --- a/XHTMLWriter.py +++ b/XHTMLWriter.py @@ -27,6 +27,8 @@ class XHTMLWriter: output += '
\n' output += item.contents output += '\n
\n' + if item.commentsURL: + output += '

Comments

' % item.commentsURL output += '\n' return output @@ -40,6 +42,9 @@ class XHTMLWriter: output += 'Planet UCC\n' output += '\n' output += '\n' + output += '\n' + output += '\n' + output += '\n' output += '\n' output += '\n' output += '
\n' @@ -90,7 +95,8 @@ class XHTMLWriter: return output def __blog_sort__(self, blog1, blog2): - name1, name2 = blog1.blogName.split(' ')[-1], blog2.blogName.split(' ')[-1] + # name1, name2 = blog1.blogName.split(' ')[-1], blog2.blogName.split(' ')[-1] + name1, name2 = blog1.blogName, blog2.blogName if name1 < name2: return -1 if name1 == name2: return 0 if name1 > name2: return 1 diff --git a/XMLParse2.py b/XMLParse2.py index d1ca814..978b418 100644 --- a/XMLParse2.py +++ b/XMLParse2.py @@ -31,6 +31,7 @@ class BlogItem: self.itemTitle = None self.itemDate = None self.itemURL = None + self.commentsURL = None self.contents = None class XMLParse: @@ -86,6 +87,10 @@ class XMLParse: item.blogURL = data['channel']['link'] else: item.blogURL = self.feedURL + if data['feed'].has_key ('image') and data['feed']['image'].has_key ('url'): + item.imageURL = data['feed']['image']['url'] + if data['feed'].has_key ('image') and data['feed']['image'].has_key ('link'): + item.imageLink = data['feed']['image']['link'] for entry in data['items']: blogItem = BlogItem() if entry.has_key('title'): @@ -96,13 +101,16 @@ class XMLParse: blogItem.itemURL = entry['link'] else: blogItem.itemURL = item.blogURL - if entry.has_key('date_parsed'): - blogItem.itemDate = time.mktime(entry['date_parsed']) + 28800 + if entry.has_key('modified_parsed'): + try: blogItem.itemDate = time.mktime(entry['modified_parsed']) + 28800 + except: blogItem.itemDate = 0 else: blogItem.itemDate = 0 if entry.has_key('description'): blogItem.contents = entry['description'] else: blogItem.contents = '(entry could not be retrieved)' + if entry.has_key ('comments'): + blogItem.commentsURL = entry['comments'] item.items.append(blogItem) return item diff --git a/XMLWriter.py b/XMLWriter.py index a4bca9d..27f4738 100644 --- a/XMLWriter.py +++ b/XMLWriter.py @@ -19,6 +19,7 @@ class PlanetItem: self.imageURL = blog.imageURL self.imageLink = blog.imageLink self.contents = item.contents + self.commentsURL = item.commentsURL class PlanetDate: def __init__(self, date): diff --git a/feedlist b/feedlist index 1d4c289..4446675 100644 --- a/feedlist +++ b/feedlist @@ -34,7 +34,6 @@ Rob Slaughter http://www.livejournal.com/users/robthesilent/data/rss Alex Dawson http://www.livejournal.com/users/theducks/data/rss Tracey Brown http://www.livejournal.com/users/tazaria/data/rss Lionel Pryce http://www.livejournal.com/users/jetblackvalias/data/rss -Carlo Andreacchio http://www.livejournal.com/users/the_icon_of_sin/data/rss Rohan Joyce http://www.livejournal.com/users/booto/data/rss Greg Cresp http://www.livejournal.com/users/the_riviera_kid/data/rss Adrian Woodley http://www.diskworld.com.au/blog/adrian/index.rss @@ -59,5 +58,7 @@ Thomas Pope http://www.livejournal.com/users/tomtim/data/rss Stephen Griffiths http://www.livejournal.com/users/utopos/data/rss David Adam http://zanchey.ucc.asn.au/zanchey.rss Antony N. Lord http://www.livejournal.com/users/antonylord/data/rss -James French http://www.frenchie.id.au/frenchierss.php +James French http://frenchie.ucc.asn.au/frenchie.rss Shay Telfer http://www.earthyself.com/blog/index.rdf +Oliver Mailes http://www.livejournal.com/users/oliverm/data/rss +Tim Duheaume http://www.livejournal.com/users/squimmy/data/rss diff --git a/sidebar.html b/sidebar.html index 9ceb2a2..8c71c60 100644 --- a/sidebar.html +++ b/sidebar.html @@ -18,15 +18,14 @@ the Planet Master.

Syndication

-

- Planet UCC offers - RSS 1.0, - RSS 2.0, - FOAF, and - OPML - feeds of this webpage. +

+  RSS 1.0  + RSS 2.0
+  FOAF  + OPML

-

Links

-

- UCC Homepage +

+

+  Hacking Life  +  UCC 

diff --git a/update-planet b/update-planet index 6beba5e..7f31e52 100755 --- a/update-planet +++ b/update-planet @@ -55,6 +55,7 @@ try: codecs.open('planet.html', 'wb', 'utf-8').write(xmlwriter.write(XHTMLWriter.XHTMLWriter)) except: sys.stderr.write('DEBUG: update-planet: could not write planet.html, aborting\n') + raise try: codecs.open('rss2.xml', 'wb', 'utf-8').write(xmlwriter.write(RSS2Writer.RSS2Writer)) @@ -75,7 +76,7 @@ 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 + if not tainted: sys.stdout.write('PlanetUCC: no objects have changed in the cache, not updating\n') -- 2.20.1