Monday, November 08, 2010 at 12:00 AM.

scripting2Suite.server.getEnclosure

on getEnclosure (adrstory) {
	<<Changes
		<<6/14/10; 5:44:24 PM by DW
			<<Search the top level headlines of the story for a link enclosure, get the url, get its content type and length, and create a sub-table called enclosure with the info. This is then used by in building the RSS feed.
	local (adrsummit = scripting2Suite.server.getStorySummit (adrstory), adr);
	for adr in adrsummit {
		if nameof (adr^) endswith "outline" {
			local (adratts = @adr^.["/atts"]);
			if defined (adratts^.type) {
				if adratts^.type == "link" {
					try {
						local (url = adratts^.url, type, length);
						tcp.httpGetTypeLength (url, @type, @length, 5);
						if not defined (adrstory^.enclosure) {
							new (tabletype, @adrstory^.enclosure);
							adrstory^.enclosure.url = url;
							adrstory^.enclosure.type = type;
							adrstory^.enclosure.length = length;
							return (true)}}}}}};
	return (false)};
bundle { //test code
	getEnclosure (@scripting2Data.server.users.davewiner.calendar.["2010"].["06"].["14"].["00259"])}



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.