Ideas on Merging Media RSS with the RSS Enclosure Element

Posted 31 Aug 2005 at 07:50 UTC by tnt Share This

Dave Winer had the excellent foresight to add the <enclosure> element to RSS.[1] The whole podcasting/IPradio thing would have likely never come about if it wasn't for this. (Or at least not come about so soon.) But, the RSS community has gained implementation experience through use of the <enclosure> element and found some shortcomings. Many have even started proposing alternatives to using the <enclosure> element.

One of the many alternatives to the RSS <enclosure> element is the RSS module known as Media RSS. (I'm pointing this one out because I feel that it has many good ideas designed into it. Although it doesn't include all the good ideas I've seen with RSS <enclosure> element alternatives.)

I'd like to propose a way of adding all (or almost all) the ideas from Media RSS to (regular) RSS by tweaking existing RSS elements.

Note that any RSS feed with these tweaks will NOT be a valid RSS 2.0 feed. However, I believe that these tweaks will be backwards compatibile. And that almost all RSS readers will be able to handle an RSS feed with these tweaks. In the same way a pre-RSS 2.0 feed reader can handle RSS 2.0 feeds. Please also note that this proposal does not try and propose any new RSS elements. It makes a point to reuse existing RSS elements in new ways. (Although it does add some new attributes to existing elements.)

Also, just to say it explicitly, I am NOT saying that people should create RSS feeds with these tweaks and label them with a 2.0 version number. (Even though I use the 2.0 version number in the examples.) PLEASE DO NOT DO THAT! This is just a proposal; a thought experiment. (I used the 2.0 version in the examples because I didn't want to suggest that there was a newer version of RSS out there with these tweaks.) The purpose of this proposal is to help influence the next version of RSS for the better. (In fact, I'd say that this proposal can even be improved to add more desired features to the RSS <enclosure> element. However, that is out of the scope of this article. This article only tries to merge the ideas from Media RSS into regular RSS using existing RSS elements in new ways.)

Like I've already said, Media RSS has alot of good ideas designed into it. However, the problem I see with it is that it totally replaces with RSS <enclosure> element. This type of thing causes duplication of data to be put into an RSS feed; which is a bad thing. (Especially since I believe it can be avoided. Well, it can be avoided if this, or tweaks like it, can be added to newer versions of RSS.) Namely, if a publisher wanted to support both RSS readers that understood the Media RSS extension and RSS readers that did NOT understand the Media RSS extension then they'd have to use the RSS <enclosure> element and the Media RSS <media:content> element in the same <item>; both pre-downloading the same thing. It gets even worse if you want to support other RSS <enclosure> element alternatives too. In fact, this duplication is actually being done already by some sites.

Many of the new elements in Media RSS correspond to existing RSS elements. For example:

  • <media:content> is like <enclosure>,
  • <media:adult> is like <rating>,
  • <media:title> is like <title>,
  • <media:thumbnail> is like <image>,
  • <media:category> is like <category>,
  • <media:credit> is like <author>,
  • and <media:text> is like <description>.

We can reuse the RSS <enclosure> element by changing from the <enclosure /> style XML element to a <enclosure>...</enclosure> style XML element; and letting some existing RSS elements be nested inside of it. It's probably easiest to just see what I'm talking about with an example; so here's an example:

    <?xml version="1.0"?>
    
    <rss version="2.0">
        <channel>
            <title>Example</title>
            <description>An Example.</description>
            <link>http://example.com/joe</link>
        
            <item>
                <link>http://example.com/2005/08/28/hockey-game</link>
                <enclosure url="http://example.com/hockey-game.mpeg.torrent" length="55218" type="application/x-bittorrent;disposition-type=moving-image">
                    <title>Joe Blow's Hockey Game - 2005-08-28</title>
                    <rating scheme="adult">false</rating>
                    <author role="camera-operator">Mother Blow</author>
                    <author role="special-effects">Micheal Blow</author>
                    <author role="http://example.com/x/extention/rss/author/hockey-player">Joe Blow</author>
                    <category domain="http://example.com/x/extension/rss/category/home-movies">About:Hockey Of:Joe_Blow Year:2005 Month:August Day:28 DayOfWeek:Sunday</category>
                </enclosure>
            </item>
</channel> </rss>

Note, in the example, for the type attribute of the <enclosure> element I used a disposition-type from RSS Disposition Hinting Proposal. Also note, I've used some (currently) non-standard attributes too on these elements. Like the scheme attribute on <rating>; and the role attribute on the <author> element. I think that adding these here (when the elements are under an <enclosure>) will be OK, since this use is completely new. (I'm not trying to make a case for adding these attributes to these elements when they are used in other places; like [directly] under the <channel> element or the <item> element. This proposal doesn't even touch that issue.)

This would cover almost everything in the Media RSS spec, except for 2 things:

  1. allowing multiple (different) <enclosure> elements in an <item>,
  2. and the <media:group> element.

For #1 the solution is pretty easy. Just start allowing it. We just need to agree that it is OK to have multiple <enclosure> elements in an <item>.

For #2, once we allow #1, we could do this with the <guid> element. The logic of it would be that those <enclosure> elements with the same <guid> are considered just alternatives to the same thing. For example:

    <?xml version="1.0"?>
    
    <rss version="2.0">
        <channel>
            <title>Example</title>
            <description>An Example.</description>
            <link>http://example.com/joe</link>
        
            <item>
                <link>http://example.com/2005/08/28/hockey-game</link>
                <enclosure url="http://example.com/hockey-game.mpeg" length="7855218" type="video/mpeg">
                    <guid>ebcc089d-17cf-42c0-a701-8770516ba342</guid>
                    <title>Joe Blow's Hockey Game - 2005-08-28</title>
                    <rating scheme="adult">false</rating>
                    <author role="camera-operator">Mother Blow</author>
                    <author role="special-effects">Micheal Blow</author>
                    <author role="http://example.com/x/extention/rss/author/hockey-player">Joe Blow</author>
                    <category domain="http://example.com/x/extension/rss/category/home-movies">About:Hockey Of:Joe_Blow Year:2005 Month:August Day:28 DayOfWeek:Sunday</category>
                </enclosure>
                <enclosure url="http://example.com/hockey-game.ogg" length="7854168" type="application/ogg;disposition-type=moving-image">
                    <guid>ebcc089d-17cf-42c0-a701-8770516ba342</guid>
                    <title>Joe Blow's Hockey Game - 2005-08-28</title>
                    <rating scheme="adult">false</rating>
                    <author role="camera-operator">Mother Blow</author>
                    <author role="special-effects">Micheal Blow</author>
                    <author role="http://example.com/x/extention/rss/author/hockey-player">Joe Blow</author>
                    <category domain="http://example.com/x/extension/rss/category/home-movies">About:Hockey Of:Joe_Blow Year:2005 Month:August Day:28 DayOfWeek:Sunday</category>
                </enclosure>
            </item>
        
        </channel>
    </rss>

Note that for the above example, the first <enclosure> was in MPEG format and the second <enclosure> was in Ogg Theora format. (But they were both of the same thing.)

Here's another example that provides an adult and non-adult version of the same thing:

    <?xml version="1.0"?>
    
    <rss version="2.0">
        <channel>
            <title>Example</title>
            <description>An Example.</description>
            <link>http://example.com/joe</link>
        
            <item>
                <link>http://example.com/2005/08/29/gerrys-stag-party</link>
                <enclosure url="http://example.com/stag-party.mpeg.torrent" length="55218" type="application/x-bittorrent;disposition-type=moving-image">
                    <guid>f166226c-355f-41e1-b206-3d1be1e0483e</guid>
                    <title>Gerry's Stag Party: XXX-Version</title>
                    <rating scheme="adult">true</rating>
                </enclosure>
                <enclosure url="http://example.com/stag-party-censored.mpeg.torrent" length="55112" type="application/x-bittorrent;disposition-type=moving-image">
                    <guid>f166226c-355f-41e1-b206-3d1be1e0483e</guid>
                    <title>Gerry's Stag Party</title>
                    <rating scheme="adult">false</rating>
                </enclosure>
            </item>
        </channel>
    </rss>

And here's an example with <enclosure> elements of 3 different things. Some with different alternatives of the same thing.

    <?xml version="1.0"?>
    
    <rss version="2.0">
        <channel>
            <title>Example</title>
            <description>An Example.</description>
            <link>http://example.com/joe</link>
        
            <item>
                <title>A whole bunch of stuff</title>
                <enclosure url="http://example.com/hockey-game.mpeg" length="7855218" type="video/mpeg">
                    <guid>ebcc089d-17cf-42c0-a701-8770516ba342</guid>
                    <title>Joe Blow's Hockey Game - 2005-08-28</title>
                    <rating scheme="adult">false</rating>
                    <author role="camera-operator">Mother Blow</author>
                    <author role="special-effects">Micheal Blow</author>
                    <author role="http://example.com/x/extention/rss/author/hockey-player">Joe Blow</author>
                    <category domain="http://example.com/x/extension/rss/category/home-movies">About:Hockey Of:Joe_Blow Year:2005 Month:August Day:28 DayOfWeek:Sunday</category>
                </enclosure>
                <enclosure url="http://example.com/hockey-game.ogg" length="7854168" type="application/ogg;disposition-type=moving-image">
                    <guid>ebcc089d-17cf-42c0-a701-8770516ba342</guid>
                    <title>Joe Blow's Hockey Game - 2005-08-28</title>
                    <rating scheme="adult">false</rating>
                    <author role="camera-operator">Mother Blow</author>
                    <author role="special-effects">Micheal Blow</author>
                    <author role="http://example.com/x/extention/rss/author/hockey-player">Joe Blow</author>
                    <category domain="http://example.com/x/extension/rss/category/home-movies">About:Hockey Of:Joe_Blow Year:2005 Month:August Day:28 DayOfWeek:Sunday</category>
                </enclosure>
                <enclosure url="http://example.com/hockey-game.avi" length="9972184" type="video/x-msvideo">
                    <guid>ebcc089d-17cf-42c0-a701-8770516ba342</guid>
                    <title>Joe Blow's Hockey Game - 2005-08-28</title>
                    <rating scheme="adult">false</rating>
                    <author role="camera-operator">Mother Blow</author>
                    <author role="special-effects">Micheal Blow</author>
                    <author role="http://example.com/x/extention/rss/author/hockey-player">Joe Blow</author>
                    <category domain="http://example.com/x/extension/rss/category/home-movies">About:Hockey Of:Joe_Blow Year:2005 Month:August Day:28 DayOfWeek:Sunday</category>
                </enclosure>
                <enclosure url="http://example.com/stag-party.mpeg.torrent" length="55218" type="application/x-bittorrent;disposition-type=moving-image">
                   <guid>f166226c-355f-41e1-b206-3d1be1e0483e</guid>
                    <title>Gerry's Stag Party: XXX-Version</title>
                    <rating scheme="adult">true</rating>
                </enclosure>
                <enclosure url="http://example.com/stag-party-censored.mpeg.torrent" length="55112" type="application/x-bittorrent;disposition-type=moving-image">
                <guid>f166226c-355f-41e1-b206-3d1be1e0483e</guid>
                    <title>Gerry's Stag Party</title>
                    <rating scheme="adult">false</rating>
                </enclosure>
                <enclosure url="http://example.com/watchme.mpeg.torrent" length="54118" type="application/x-bittorrent;disposition-type=moving-image">
                    <guid>aadd1e12-d319-4192-8428-82e37e7b3ea5</guid>
                    <title>Watch Me Video</title>
                    <rating scheme="adult">false</rating>
                    <description>Watch this first.</description>
                    <image>
                        <url>http://example.com/watchme-thumbnail.png</url>
                        <width>160</width>
                        <height>120</height>
                    </image>
                </enclosure>
            </item>
        
        </channel>
    </rss>

Media RSS also has some extra attributes for the <media:content> element (not found in any of the examples I've created so far). These could "just be added" to the RSS <enclosure> element. Or could be added through a namespace.

Note, the only thing that this proposal didn't cover is the <media:player> element. (And that was intentional.) That is because although I understand the use of it, and even think it is good to have a way of doing this with RSS (maybe through an RSS module). I don't think it belongs with the RSS <enclosure> element. The RSS <enclosure> element means "pre-download this" (as far as I know). And not "play this". (Even though I think that is how some people are somewhat conceptualizing it. I believe that conceptualizing it in that way in wrong.) So I think the <media:player> element can be dealt with as part of fixing or improving the RSS <description> element and creating a way to refer to the "resource" that the <enclosure> pre-downloaded (probably through a URI like the CID URI described in RFC 2392 I believe; which would be topics of other, yet to be written, proposals).


Feed Validator is OK with <enclosure></enclosure>, posted 8 Sep 2005 at 09:19 UTC by tnt » (Master)

Just a note. Feed Validator is OK with changing the enclosure element from <enclosure /> to <enclosure></enclosure>.

While that does NOT mean that all RSS readers will be OK. It shows that one important one RSS reader is.

(Although it did complain when I put existing RSS elements under it. That, of course, is NOT RSS 2.0 complaint. Which is what I expected.)

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!

X
Share this page