Monday, September 20, 2004


Enclosures


Don’t fear, I have no plans to start (gack) audioblogging, but I was curious about what kind of effort it would take to add RSS enclosure support to my Blosxom installation. Answer: not much. Mind-numbing detail follows for the Blosxom geeks, everyone else can skip the rest.


Enclosure is an optional RSS 2.0 element, defined in the core. My RSS 2.0 flavour (or template, for those of you coming from other blogging systems) is something that I think I borrowed from another Blosxom user at some point, though I’ve hammered on it enough so that I should be personally blamed for anything broken in it. I’m proud to say that it’s “funky” as hell, using Dublin Core elements wherever I can possibly get away with it. :)

Enclosure support in Blosxom simply requires two plugins I was already using anyhow: meta and interpolate conditional. For any story (article, entry, whatever) which I want to attach a media file, I declare 3 meta variables at the top of the article:

meta-enclosure_url: http://www.freeke.org/chewns/Simpsons-Canyonero.mp3
meta-enclosure_length: 1911932
meta-enclosure_type: audio/mpeg

In my RSS 2.0 flavour, (specifically in the story flavour file) I add a single line in the RSS <item>:

?{$meta::enclosure_url <enclosure_url="$meta::enclosure_url" length="$meta::enclosure_length" type="$meta::enclosure_type" />}

I’m still toying with the idea of including the enclosures in my Atom 0.3 flavour as a namespaced element from RSS 2.0. That shouldn’t break anything, right?


:: Dave Walker 12:09 (EST/EDT) [+] ::

:: [/tech/computers/blosxom]
:: tags:

:: Comments (6)

Comments:

Sam Ruby wrote:

Title: http://www.intertwingly.net/blog/

Date:

Response:
Consider using the following for Atom: ?{$meta::enclosure_url }

Sam Ruby wrote:

Title:

Date:

Response:
Trying again due to the aggressive stripping: link rel="related" type="meta::enclosure_type" href="meta::enclosure_url"

d.w. wrote:

Title:

Date:

Response:
Thanks, Sam. I'll play around with that. Sorry about the stripping -- lately I've had comment spammers hammering on me and I figured it was better to err on the side of caution in case they escalate things further.

Title: Bigger Question

Date:

Response:
The bigger question is how much effort would it take implement interesting applications around those enclosures? I voted 3-6 months and the investors agreed :)

Drew Bell wrote:

Title: enclosures

Date:

Response:
If i might ask, what do you use to write your blog posts in. I am using vi from the cli and because i don't know the proper formatting code to add the meta info, i can't add the items. What is the best way that you know of to post with enclosures. Drew

d.w. wrote:

Title:

Date:

Response:

Drew: I write my posts in SubEthaEdit, an OS X text editor, using Markdown syntax, which I convert to HTML via a macro. I then filter the posts through HTML Tidy (using another macro), and, for posts with enclosures, I add the three meta tags (as in the entry above) right below the post title before saving the entry in place in my Blosxom posts hierarchy.





Some men feel that the only thing they owe the woman who marries them is a grudge. -- Helen Rowland