Saturday, May 12, 2012

oPod Away to Cut Podcast Cord

So if you want to cut the cord, you can. - Scott Forstall
I wrote a little app called "oPod Away" because I love podcasts and I often travel which takes me away from my personal computer which is what my iPhone syncs with. Apple has been slowly making it easier and easier to use an iOS device without any need to connect it to a computer, but they are not there yet. One of the areas where they are failing is with podcast syncing. When I am traveling and not near my personal computer how do I get my latest and greatest podcasts onto my iPhone? The internet tells me I should be using Skitcher to solve this problem, but it doesn't have 100% of my podcasts and anything less than 100% is not enough.
I wrote server-side "oPod Away" a few years ago as a server-side Perl script that ran on my home server. The point was to go through my complete podcast OPML, pull down all the RSS feeds, and then show me the last updated stamp for each. So when I was on the road I could just open on the page, see what's been updated, and then tap on it to go over the iTunes Store on my phone and download. It works great - takes abou 30 seconds to run.

Since HTML5 is all the rage these days I decided to re-write the program using HTML5 and do it all client side. Sound great? I quickly ran into the problem of Cross-Origin Resource Sharing. When I used XmlHttpRequest on a page on my server to pull the podcast RSS feed it would cause an origin error. I tried to think through creative solutions to this problem like using Yahoo Pipes, but wasn't able to get something like. I ended up throwing up a very simple proxy on Google App Engine. So now the whole application is written in HTML5 and can run on the phone. It takes about 3 seconds for a refresh and I can get my podcasts where ever I go.