Tuesday, August 18, 2009 at 7:35 PM.

photoFanSuite.checkFeed

on checkfeed (adrfeed) {
	<<Changes
		<<3/15/08; 8:19:30 PM by DW
			<<Replace remaining call to tcp.httpReadUrl with photoFanSuite.httpClient.
		<<2/8/08; 11:27:50 AM by DW
			<<Use photoFanSuite.httpClient.
		<<11/25/07; 1:35:44 PM by DW
			<<Ported from flickrFan.
	photoFanSuite.initFeed (adrfeed);
	<<edit (adrfeed)
	if adrfeed^.enabled {
		local (url = nameof (adrfeed^), urllist = string.urlsplit (url), flchanged, xmltext);
		adrfeed^.ctChecks++; adrfeed^.whenLastCheck = clock.now ();
		if string.lower (urllist [2]) endswith "flickr.com" {
			xmltext = flickr.readfeed (url, @flchanged)}
		else {
			xmltext = photoFanSuite.httpClient (url, flmessages:false); //2/8/08 by DW
			flchanged = true};
		if flchanged {
			local (xstruct);
			xml.compile (xmltext, @xstruct);
			if adrfeed^.type == "rss" {
				<<local (subfoldername = nil)
				<<if defined (adrfeed^.title)
					<<if adrfeed^.title != ""
						<<subfoldername = adrfeed^.title
				photoFanSuite.parseXstruct (@xstruct, adrfeed)};
			if adrfeed^.type == "opml" {
				local (adropml = xml.getaddress (@xstruct, "opml"));
				local (adrbody = xml.getaddress (adropml, "body"), adr);
				for adr in adrbody {
					if nameof (adr^) contains "outline" {
						try {
							<<local (subfoldername)
							<<bundle //set subfoldername
								<<try 
									<<subfoldername = adr^.["/atts"].title
								<<else
									<<subfoldername = nil
							local (url = xml.entitydecode (adr^.["/atts"].xmlUrl, true)); //10/30/07 by DW
							local (xmltext = photoFanSuite.httpClient (url, flmessages:false), xstruct);
							xml.compile (xmltext, @xstruct);
							photoFanSuite.parseXstruct (@xstruct, adrfeed)}}}}}}};
bundle { //test code
	local (url = "http://api.flickr.com/services/feeds/photos_public.gne?lang=en-us&format=rss_200&id=22221172@N00");
	url = "http://feeds.flickrfan.org/afp.xml";
	photoFanSuite.init ();
	checkfeed (@user.photoFan.feeds.[url])}



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.