The Localhost Podcast

Justin Wernick <>
Curly Tail, Curly Braces
2020-05-27

Abstract

I wanted to manage the process of syncing audiobooks from my computer to my phone better. The solution that worked well for me is to use a podcasting app and an RSS feed. This article explains why this works well for me, and how you can try it out.

The Problem

This article may just show off how useless I am when it comes to using my phone effectively, but I have a puzzle that's been bouncing around in my head for a while. In fact, this puzzle keeps coming back in various forms.

I have some media files sitting on my computer. I want to watch or listen to them on my phone, then delete them. Consider an audiobook, or a course of lectures as a typical case of what I mean.

I've recently come up with a solution that seems to work fairly well with the way I like to work. It won't work for everyone, but I'd like to share it on the odd chance that someone else likes the approach.

When Does This Problem Come Up?

Depending on where you are in the world, this problem statement may seem silly. Surely all media is available for streaming at any time now? If that's your opinion, I'd like to add some local context.

  1. In South Africa, it's still common to have a data limit on your home internet. It's common for the packages to include additional off-peak data, so someone might find it easier to download a large video at midnight to watch later.

  2. Even if you don't have uncapped internet at home, you may have access to internet at work, school, or a coffee shop. However, even though nobody minds you making use of the office internet, at work you'd be expected to be working, so again this is an opportunity to download large files and watch them later.

  3. If you want to watch or listen during your commute, the cellphone signal may be particularly unstable. I used to take the train to work, and it helps to already have things downloaded beforehand.

  4. Not everything is easily streamable. Maybe you bought the audiobook on a CD, checked them out from a library, or the lecture videos were provided by your employer.

Previously, I tried to solve this the way I would with any other computer. I shared the files over the network and copied them from my phone. This leaves the job of keeping track of which video you've already watched, and cleaning them up, as a manual job. How can we automate this?

The Solution: An RSS Feed for a Fake Podcast

After years of listening to podcasts, I had a sudden realization: the way that my podcast app acts is the exact way that I want to consume these media files that I have on my computer! The only missing piece is that the media files on my computer aren't hosted online, and they don't have an RSS feed that I can subscribe to.

As a software engineer, this is a simple enough problem to solve. I set up an RSS feed using a simple web server on my computer, serve it on my local network, then subscribe to it on my phone.

Step 1: Set Up the RSS Feed

An RSS feed might sound complicated, but it's just a file. Traditionally it's called rss.xml, but really you can call it whatever you want.

Create a new folder for your "podcast", and copy the files you want on your phone there. Then, create a file called rss.xml. Here's a minimal template that you can use.

<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
  <title>Localhost: The Podcast</title>

  <item>
    <title>Video part 1</title>
    <enclosure url="http://192.168.8.3/part-1.mp4" type="video/mp4"/>
  </item>
  <item>
    <title>Book part 1</title>
    <enclosure url="http://192.168.8.3/part-1.mp3" type="audio/mp3"/>
  </item>
</channel>
</rss>

The important part is that each file you want to send to your phone needs to be in an <item> tag. Each item needs an <enclosure> with the URL of the file.

The URL must be absolute, so you'll want to put your IP address in there. Mine is currently 192.168.8.3.

Update (30 May 2020): A reader has pointed out that you can automate this step with a program called genRSS. Thank you for the suggestion, Raf!

Step 2: Host the Feed on Your Local Network

You only need to run this web server long enough to subscribe to it on your phone and download things. It doesn't need to scale up to more users than just you. Any simple development web server will do fine here.

One that I happen to already have installed is Microserver. You need it to serve the files in your podcast directory on port 80 (that's the default port for HTTP traffic). Depending on your exact operating system, you'll probably need to run this with sudo to be able to bind to port 80.

cd ~/localhost-podcast
microserver -p 80

Step 3: Subscribe From Your Phone

The final step is to open whatever podcast listening app you like on your phone. I personally use one called Podcast Addict. Do whatever you need to in the app to subscribe to a new podcast by RSS feed. When it asks for the feed URL, you want to point it at the RSS file on your computer, using your computer's IP address. For example, mine is http://192.168.8.3/rss.xml.

After you've downloaded your localhost podcasts, you can stop the web server on your computer. You only need it to be running when you're downloading more files to your phone.

Step 4 (Optional): Potential Improvements

I've gone really minimal with this template, so it's missing some nice to have features. For example, if you get something wrong and edit your URL, your podcast app will add a new entry, rather than updating the broken one. This is because I didn't include the <guid> property. I'm sure there are all sorts of improvements that could be made by extending the RSS template.

You can also make it pretty on your phone by adding things like album art. Check out this RSS 2.0 Specification for information on the other RSS elements you can use!

I Hope This Was Useful

I hope this helped you to get your own "localhost podcast" set up. I've found this to be a useful tool for getting media onto my phone. With the current COVID-19 lockdown in place, I'm not exactly listening to anything on my commute, but I still enjoy having an audiobook while doing chores around the house. Enjoy!


If you'd like to share this article on social media, please use this link: https://www.worthe-it.co.za/blog/2020-05-27-localhost-podcast.html

Copy link to clipboard

Tags: blog, linux, music


Support

If you get value from these blog articles, consider supporting me on Patreon. Support via Patreon helps to cover hosting, buying computer stuff, and will allow me to spend more time writing articles and open source software.


Related Articles

Automated Syncing with Git

I wanted Dropbox-style syncing of my notes between my computers. However, rather than actually using Dropbox, I wanted to keep my notes in a Git repo so that I can manage it the same way that I manage code that I write. This article shows how I achieved this using Git Sync and Systemd.

Using Git for Incremental Backups

I've decided to start managing more of my email myself, on my local computer, rather than relying on Gmail to keep it archived forever. This means that I need to backup my email myself. In this article, I share what my considerations were for this and the script I wrote to do it automatically.

Subscribe to my RSS feed.