Tubes Beats Yahoo Pipes: Feed Fixup
Although it has only been a couple of weeks since I started work on Tubes, the mechanism I put in place to output feeds is already serving me very well. So well that it’s approaching all of my personal needs. This may potentially be bad for other people, but it’s great for me. Besides, I put the code out there; it should be easy enough to fork it if you wish it to do more! Bitbucket is also said to make it easy to merge such changes in later. I should also point out that the large majority of the work was of course done by the people who made SimplePie.
Anyway, I wanted to subscribe to the UN News podcast. To my surprise, gPodder was incapable of handling it. No surprise, as it turns out, because it’s not even proper according to the iTunes enclosure specification (although I imagine it works in iTunes). SimplePie had a nice get_enclosure() function already, so the first step, adding a proper enclosure to my Tube’s output feed, was a matter of minutes. The UN also fails to specify any size information, however, which I can’t say I was too enthused about in my trusty gPodder interface. Another 10 minutes or so later, I finished adding some cURL magic to my application. I should probably stash it away into a class later and see if I can somehow make it utilize SimplePie’s cache system to minimize useless traffic, but for now I just stuck it straight in the feed generation code. Now the UN feed is transformed from something gPodder couldn’t handle into something that essentially fixes all the UN did wrong. Thank you SimplePie for providing this great foundation!
<item> <title>UN Daily News 12 March 2010</title> <itunes:author>United Nations Radio</itunes:author> <itunes:subtitle>News and features from United Nations Radio.</itunes:subtitle> <itunes:summary></itunes:summary> <enclosure url="http://downloads.unmultimedia.org/radio/en/ltd/mp3/2010/10031200.mp3" length="" type="audio/mpeg" /> <guid>http://downloads.unmultimedia.org/radio/en/ltd/mp3/2010/10031200.mp3</guid> <pubDate>Fri, 12 Mar 2010 11:42:32 EST</pubDate> <itunes:duration>0:00</itunes:duration> </item>
<entry> <author> <name>United Nations Radio</name> </author> <title>UN Daily News 12 March 2010</title> <summary> </summary> <published>2010-03-12T11:42:32-05:00</published> <updated>2010-03-12T11:42:32-05:00</updated> <id>http://downloads.unmultimedia.org/radio/en/ltd/mp3/2010/10031200.mp3</id> <link rel="enclosure" type="audio/mpeg" href="http://downloads.unmultimedia.org/radio/en/ltd/mp3/2010/10031200.mp3" length="6720384" /> <link rel="alternate" type="text/html" href="http://downloads.unmultimedia.org/radio/en/ltd/mp3/2010/10031200.mp3"/> </entry>
I realize the alternate link currently has the wrong type attribute, which I’ll look into fixing, but at least my gPodder can handle the feed now.
I also set up a little demo so you can check the difference with the original feed for yourselves. I’d be curious to hear how different podcatchers handle both feeds.