Multiple format Wordpress podcast feeds

Warning: technical Wordpress, PHP, and podcasting stuff ahead. Wordpress has this really nice feature where linking to an audio/video file in a post makes that linked audio/video file show up in your RSS feed, automatically making your feed a podcast feed that people can use to grab your podcast in a podcatching application like Rhythmbox or iTunes or whatever. This is good stuff; it requires no extra effort from you to do this, it just works. However, over at Shot of Jaq, we release each episode in two formats: Ogg Vorbis and MP3. So what I wanted was to have both those formats show up in our podcast feed. The way Wordpress works out which links are audio files is: it looks at all the links in your post and fetches them to find out which mimetype they are served as by your webserver. They need to be served with a mimetype of audio/* to be considered as audio. It is possible, if you’re doing Ogg Vorbis, that your webserver is serving the files as application/ogg instead of audio/ogg; if your files really are audio, then you should be using the latter. So, I fixed that, and then I got what I wanted; the Shot of Jaq RSS feed had two enclosures in for each post. I was wrong to want this. The RSS specification says that you can only have one “enclosure” for each item — an enclosure is a linked file, like the audio files we’re talking about. So, I needed some other solution. Lots of people have recommended various Wordpress plugins, such as Podcasting or Blubrry PowerPress. Every one of these has the massive disadvantage that they are not automatic; I have to, for each post, say “my ogg file is this” and “my mp3 file is this”, rather than having Wordpress work it out for me. That sucks. So, I have written a minuscule Wordpress plugin. sil-enclosure-mimetype-filter. Drop it in your Wordpress plugins folder and enable it through the Wordpress administration screens. This will in no way fix your main feed; that will still have two (or more) enclosures in each item, and will still be broken. However, the plugin now gives you additional feeds: if your feed before was http://mypodcast/feed/, you now have http://mypodcast/feed/?enclosure_mimetype=audio/mpeg which is a feed for just your MP3s, and http://mypodcast/feed/?enclosure_mimetype=audio/ogg which is a feed for just your Ogg Vorbis files. What we then did with Shot of Jaq was burn those feeds with Feedburner; go and tell Feedburner that your feed is at http://mypodcast/feed/?enclosure_mimetype=audio/mpeg and give it some kind of convenient name, and then tell everyone to subscribe to that Feedburner URL. (You may also find the Feedsmith plugin useful, which will redirect requests for your existing feed to a Feedburner feed instead.)

I'm currently available for hire, to help you plan, architect, and build new systems, and for technical writing and articles. You can take a look at some projects I've worked on and some of my writing. If you'd like to talk about your upcoming project, do get in touch.

More in the discussion (powered by webmentions)

  • (no mentions, yet.)