Podcasting with Typo and externally-hosted content

Posted by Nick Sieger Tue, 23 May 2006 03:59:00 GMT

My first trials in podcasting have been relatively enjoyable with Typo. Although I wouldn’t recommend the approach I’ve taken for someone who isn’t willing to get their hands pretty dirty.

I chose to save money at the expense of time and posted my podcasts to ourmedia.org before realizing that Typo (svn rev 947) does not have native support for externally-hosted enclosures. Following are the hacks I’ve taken to work around that.

  • In Typo Admin->Resources, upload a “blank” or dummy version of the file you want to serve in your feed. Save the filename you use for later (in the example below I use minnebar20060506edwards.mp3).
  • Upload the real file to the system that will be hosting the file. Get the real length of the file, e.g., using curl -I:
[22:48:37][~]$ curl -I http://www.archive.org/download/NickSiegerAgileDesign/minnebar20060506edwards.mp3
HTTP/1.1 302 Found
Date: Tue, 23 May 2006 03:47:54 GMT
Server: Apache/1.3.33 (Debian GNU/Linux) PHP/5.0.4-0.4
X-Powered-By: PHP/5.0.4-0.4
Location: http://ia301231.us.archive.org/3/items/NickSiegerAgileDesign/minnebar20060506edwards.mp3
Content-Type: text/html; charset=iso-8859-1

[22:48:51][~]$ curl -I http://ia301231.us.archive.org/3/items/NickSiegerAgileDesign/minnebar20060506edwards.mp3
HTTP/1.1 200 OK
Date: Tue, 23 May 2006 03:49:10 GMT
Server: Apache/2.0.54 (Ubuntu) PHP/5.0.5-2ubuntu1.2 mod_ssl/2.0.54 OpenSSL/0.9.7g
Last-Modified: Sat, 20 May 2006 03:39:32 GMT
ETag: "3c-1d8b320-46bc500"
Accept-Ranges: bytes
Content-Length: 30978848
Content-Type: audio/mpeg
  • Now open up a Rails console in production mode on your server -- be careful! We need to patch in the real length of the file into the resource record so that the actual length of the file appears in the RSS and Atom feeds.
$ ./script/console production
Loading production environment.
>> r = Resource.find :first, :conditions => ['filename = ?', 'minnebar20060506edwards.mp3']
=> #<Resource:0xb747c2e4 ...>
>> r.size = "30978848"                                                              
=> "30978848"
>> r.save
=> true
>> quit
  • Assuming you’re deployed on Apache (you are right?), put a permanent redirect in your public/.htaccess file:
Redirect permanent /files/minnebar20060506edwards.mp3 http://www.archive.org/download/NickSiegerAgileDesign/minnebar20060506edwards.mp3
  • Post your entry, and associate the resource to the post.
  • Check your feed to verify the enclosure entry appears as desired. Put your feed into a podcatcher and ensure the podcast can be downloaded.

As you can see, not exactly the ideal scenario. I haven’t been following recent Typo development closely but hopefully this can be made to be super-easy in a future rev of Typo. If I was a hardcore podcaster I would probably code up a patch but the above steps work fine for now.

Posted in  | Tags ,  | no comments | no trackbacks