Fork me on GitHub

Project Notes

Private PodFeed

Publishing a private podcast feed with Sinatra.


I have some old audiobook CDs ripped to mp3. I used to sync these to an iPod, but when my last iPod battery failed I gave in to streaming. Being able to load these books into my podcast app on the phone would be ideal though. Podcast apps are perfect for this (as opposed to the standard media player) as they support features like adjustable playback speed.

This is a quick and dirty Sinatra application that turns one or more folders into podcast feeds (one for each folder). It assumes the folders contain MP3s, and it reads the metadata from the files to generate feed and item names. It also proxies the request to download the enclosure file.

I’ve used this to successfully load a few old books onto my phone for reading.

A couple of things to note:

  • there’s no security on the app
  • it has a big security hole (possible to get it to download any file from your disk)

So if you want to use this, only use the app on a secured internal network, and don’t leave it running.

Running the Example

To run the app locally:

gem install bundler
bundle install
ruby app.rb

By default, the app lists pod feeds from the sample_data folder. I’ve put there a couple of episodes for a couple of Librivox recordings for testing purposes (these are not added to the repository).

To use another folder, set the root path with POD_ROOT environment variable:

POD_ROOT="/Alternate/Path" ruby app.rb

The application will bind to all interfaces on port 4567. The default home page will list the available feeds:


Use the feed links to subscribe in the podcast application. A raw feed looks like this:

$ curl http://my-mac.local:4567/feed/LibriVox_%20my-man-jeeves-by-p-g-wodehouse.xml
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
    <title>PPF: LibriVox: my-man-jeeves-by-p-g-wodehouse</title>
    <description>LibriVox: my-man-jeeves-by-p-g-wodehouse</description>
    <pubDate>Fri, 12 Jul 2024 18:19:55 +0800</pubDate>
      <enclosure url="http://my-mac.local:4567/content/LibriVox_%20my-man-jeeves-by-p-g-wodehouse/01_my-man-jeeves-by-p-g-wod.mp3"
      <pubDate>Tue, 31 Dec 2019 13:52:25 +0800</pubDate>
      <guid isPermaLink="false">01_my-man-jeeves-by-p-g-wod-1703738064</guid>
      <enclosure url="http://my-mac.local:4567/content/LibriVox_%20my-man-jeeves-by-p-g-wodehouse/02_my-man-jeeves-by-p-g-wod.mp3"
      <pubDate>Tue, 31 Dec 2019 13:52:25 +0800</pubDate>
      <guid isPermaLink="false">02_my-man-jeeves-by-p-g-wod-1703738065</guid>
    <itunes:author>P.G. Wodehouse</itunes:author>

Credits and References

Project Source on GitHub Return to the Project Catalog

This page is a web-friendly rendering of my project notes shared in the LittleCodingKata GitHub repository.

LittleCodingKata is my collection of programming exercises, research and code toys broadly spanning things that relate to programming and software development (languages, frameworks and tools).

These range from the trivial to the complex and serious. Many are inspired by existing work and I'll note credits and references where applicable. The focus is quite scattered, as I variously work on things new and important in the moment, or go back to revisit things from the past.

This is primarily a personal collection for my own edification and learning, but anyone who stumbles by is welcome to borrow, steal or reference the work here. And if you spot errors or issues I'd really appreciate some feedback - create an issue, send me an email or even send a pull-request.