Monday, April 04, 2011 at 1:05 AM.
feedhoseSuite.client.itemArrived
on itemArrived (hosename, adrx) { <<Changes <<12/3/10; 5:16:37 PM by DW <<Update for Hacker News which doesn't have descriptions in its feed. <<12/2/10; 5:54:40 PM by DW <<Decode titles and descriptions. <<10/5/10; 1:08:22 PM by DW <<Created. local (adrhose = feedhosesuite.client.inithose (hosename), now = clock.now ()); on decode (s) { //12/2/10 by DW return (xml.entitydecode (s, true, flSkipMalformedEntities:true, flDecodeHexEntities:false))}; adrhose^.stats.lastx = adrx^; local (title = decode (xml.getvalue (adrx, "title"))); if not defined (adrhose^.outline) { new (outlinetype, @adrhose^.outline)}; local (oldtarget = target.set (@adrhose^.outline)); <<local (oldcursor = op.getcursor ()) op.firstsummit (); <<speaker.sound (3, 10, 9000) bundle { //add main headline local (time = date.timestring (now, false) - " "); local (feedtitle = decode (xml.getvalue (adrx, "feedTitle"))); if string.lower (hosename) == "nytimes" { feedtitle = string.trimwhitespace (string.nthfield (feedtitle, ">", 2)); feedtitle = string.replace (feedtitle, "Most Recent Headlines", "Realtime Feed")}; op.insert (time + ": " + title + " (" + feedtitle + ")", up)}; bundle { //add description local (flhavedescription = false); try { op.insert (decode (xml.getvalue (adrx, "description")), right); flhavedescription = true}; bundle { //add attributes try { local (atts); new (tabletype, @atts); atts.type = "link"; atts.title = title; atts.url = xml.getvalue (adrx, "link"); op.attributes.addgroup (@atts)}}; if flhavedescription { op.go (left, 1); op.collapse ()}}; <<op.setcursor (oldcursor) target.set (oldtarget)}; <<speaker.sound (3, 10, 6000) bundle { //test code itemArrived ("hackerNews", @config.feedhose.client.hoses.hackerNews.calendar.["2010"].["12"].["03"].["00018"])}
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.