X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;ds=sidebyside;f=update-planet;h=0de1c287e35c83f5495dd28ba3ae2e1c74586fa4;hb=02c5a35a10ecd941123537e4334da5870e400a47;hp=843c4ce69003482aecbe4079c4a1002262f4db64;hpb=591b42e1371c3887b56e0bd2c55a7bca663208fe;p=planet-ucc.git diff --git a/update-planet b/update-planet index 843c4ce..0de1c28 100755 --- a/update-planet +++ b/update-planet @@ -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,19 +34,21 @@ 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 - if not feed[2] or not feed[2].cache or not blog or not blog.cache or feed[2].cache != blog.cache: + if not feed[2] or not feed[2].cache or not blog.cache or feed[2].cache != blog.cache: tainted = True + elif len(blog.items) > 0 and len(feed[2].items) > 0 and (blog.items[0].itemTitle != feed[2].items[0].itemTitle or blog.items[0].contents != feed[2].items[0].contents): + tainted = True # write the cache back down to disk cache.storeBlog(blog) else: pass if not tainted: - sys.stderr.write('PlanetUCC: no objects have changed in the cache, not updating\n') + sys.stdout.write('PlanetUCC: no objects have changed in the cache, not updating\n') sys.exit(1) # step 3: sift the feeds @@ -67,3 +69,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