Saturday, April 02, 2011 at 9:21 PM.
rssToBlogSuite.readFeed
on readFeed (adrblog) { <<Changes <<12/23/10; 11:22:11 PM by DW <<Created. rssToBlogSuite.initBlog (adrblog); if adrblog^.prefs.enabled { local (items, adritem, now = clock.now ()); try { xml.rss.getFeedItems (adrblog^.prefs.urlfeed, @items, @adrblog^.feedinfo); adrblog^.stats.ctReads++; adrblog^.stats.whenLastRead = now; for adritem in @items { local (guid, adrhistory); bundle { //set guid try { guid = xml.getvalue (adritem, "guid")} else { guid = ""; //synthesize the guid -- 9/10/09 by DW try {guid = guid + xml.getvalue (adritem, "pubDate")}; try {guid = guid + xml.getvalue (adritem, "link")}; try {guid = guid + xml.getvalue (adritem, "title")}; if sizeof (guid) > 0 { guid = string.hashmd5 (guid)}}}; if sizeof (guid) > 0 { local (adrhistory = @adrblog^.history.[guid]); if not defined (adrhistory^) { local (adrcal = @adrblog^.calendar); local (adrday = mainresponder.calendar.getdayaddress (adrcal, now)); local (adrpost = @adrday^.[string.padwithzeros (adrblog^.stats.ctPosts++, 5)]); new (tabletype, adrpost); rssToBlogSuite.initPost (adrpost); adrpost^.itemdata = adritem^; adrpost^.guid = guid; bundle { //save the address in the history table local (s = string.popfilefromaddress (adrpost)); s = string.delete (s, 1, sizeof (string.popfilefromaddress (adrcal) + 1)); adrhistory^ = s}}; <<adrhistory^ = string.popfilefromaddress (adrpost) //store addresses as strings bundle { //save it local (adrpost = address (string.popfilefromaddress (@adrblog^.calendar) + "." + adrhistory^)); adrpost^.itemdata = adritem^; rssToBlogSuite.saveIfNewOrChanged (adrblog, adrpost)}}}} else { adrblog^.stats.ctErrors++; adrblog^.stats.lastError = tryerror; adrblog^.stats.whenLastError = now}}}; bundle { //test code readfeed (@config.rssToBlog.blogs.scripting)} <<readfeed (@config.rssToBlog.blogs.["linkblog.xml"])
This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.