Change feed URL.
[planet-ucc.git] / update-planet
index 4e23e5b..7f31e52 100755 (executable)
@@ -38,17 +38,15 @@ for feed in feeds:
                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.stdout.write('PlanetUCC: no objects have changed in the cache, not updating\n')
-       sys.exit(1)
-
 # step 3: sift the feeds
 xmlwriter      = XMLWriter.XMLWriter(blogs)
 
@@ -57,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))
@@ -77,4 +76,9 @@ 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')
+       sys.exit(1)
+

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