Preface
I listen to podcasts to learn, to remain aprised of technology and cybersecurity news, and to relax. I also enjoy science-fiction.
This is the story of how I decided to finally imbue upon myself the cultural herritage that is The Hitch Hikers Guide To The Galaxy.
The Hitch Hikers Guide To The Galaxy
You have probably heard of Douglas Adams', The Hitch Hikers Guide To The Galaxy. In 1978, BBC4 aired the radio play. It went on to have a number of "phases", with each episode being called a "fit".
Options
I had to decide how to host the files in a convenient way. I wouldn't necessarily be able to listen to them when using my computer and I may wish to listen late at night or early in the morning when I'm in bed. This ruled out having the radio series solely on my computer, and pushed me toward having the files on my phone.
I've heard many good things about AudioBookShelf. I took a quick look, as a matter of interest. They have an early-stage mobile phone app, which is convenient. However, it requries hosting the server software and that's a not a quick proposition.
Where then to host the files? On the internet to play with VLC on my phone? There are two problems. (a) I don't have a license (if it is even necessary) to redistribute the files, therefore I would have to gate them behind user authentication, but I don't want to do that, (b) I find that VLC Player on Android can be a bit frustrating to use sometimes so dumping the files in a directory and using VLC player isn't a preferable method.
I decided to take the opportunity to re-learn how to make a podcast feed. Some people participate in daily Wordle, or Sudoku, or crosswords. I like to learn a new thing and tinker. So it was immediately clear that this proposition would be fulfilling. I'd have the files on my phone, playable through my podcast application with it's playlist features, and I can listen to it in bed or streamed to my computer via bluetooth if I so decided to.
Creating The Podcast
Obtaining The Files
I found a zip file of the episodes and artwork online, which I unzipped into a LXD container at the path /opt/HHGTTG/.
The files are in the form:
- HHGTTG.Phase1.Fit01.mp3
- HHGTTG.Phase1.Fit01.png
- HHGTTG.Phase1.Fit01_spectrogram.png
- HHGTTG.png
Configuring NGINX
I then set up an NGINX server block to serve the files:
server {
include mime.types;
listen 80 default_server;
listen [::]80 default_server;
root /var/www/html;
server_name mycontainer.lxd;
autoindex on;
autoindex_exact_size off;
autoindex_format html;
autoindex_localtime on;
location / {
try_files $uri $uri/ =404;
}
location /episodes/ {
alias /opt/HHGTTG/;
}
}
You can find the file here.
Creating The RSS Feed
I crafted a RSS feed using this specification. This was simple to generate using some well-considered macros. The feed is stored as /var/www/html/thhgttg.rss. Here is an outline of the file, with only one episode displayed (to save my bandwidth!).
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"
xmlns:podcast="https://podcastindex.org/namespace/1.0"
xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<atom:link href="http://192.168.1.251:65524/thhgttg.xml" rel="self" type="application/rss+xml" />
<title>The hitch hikers guide to the galaxy</title>
<description>Douglas Adams, THHGTTG</description>
<link>http://192.168.1.251:65524/</link>
<language>en-gb</language>
<itunes:image href="http://192.168.1.251:65524/episodes/HHGTTG.png" />
<itunes:category text="Science Fiction" />
<itunes:explicit>false</itunes:explicit>
<podcast:guid>d71b5a28-6ba0-5dd8-83c6-41be115ce2aa</podcast:guid>
<item>
<title>Phase1.Fit01</title>
<enclosure length="44926083" type="audio/mpeg" url="http://192.168.1.251:65524/episodes/HHGTTG.Phase1.Fit01.mp3" />
<guid isPermaLink="false">HHGTTG.Phase1.Fit01</guid>
<pubDate>Wed, 08 Mar 1978 00:00:00 +0000</pubDate>
<itunes:image href="http://192.168.1.251:65524/episodes/HHGTTG.Phase1.Fit01_spectrogram.png" />
</item>
</channel>
You can find the complete file here.
Configuring LXD
The webserver inside of the container listens for traffic on port 80. My computer hosts a webserver on port 80 so I would have to select a new port to use, albeit temporarily. I chose the sufficiently obscure port 65524.
In order to have LXD forward the traffic from host port 65524 to container port 80, I invoked:
lxc network forward edit lxdbr0 192.168.1.251
adding the configuration:
- description: hhgttg_podcast
protocol: tcp
target_port: "80"
target_address: 10.241.25.29
- description: hhgttg_podcast
protocol: udp
target_port: "80"
target_address: 10.241.25.29
But Daniel, why would you forward UDP when HTTP is a TCP-based protocol? The answer is that I did't know which HTTP version my podcast player uses, but if it's sufficiently new that it uses QUIC then it will infact use UDP! Now that I have logs, I can see it's HTTP/1.1.
Configuring The Firewall
Configuring the Firewall was a tad tricky. The typical rules applied, but as far as I can tell the rules that I had missed are:
sudo ufw route allow in on wlp58s0 out on lxdbr0 to 10.241.25.29 port 80 proto tcp
sudo ufw route allow in on wlp58s0 out on lxdbr0 to 10.241.25.29 port 80 proto udp
The Result
That was it! I added the feed to my podcast client and synchronized the feed. Thirty Two episodes and their artwork flooded into my client. Here are the screenshots of the podcast amongst the other feeds, and the feed itself. I've blurred unrelated things to make it clear what we're looking at (and also because I'm not going to show you someone else's adverts!).
The HHGTTG Feed, amongst other feeds:
The HHGTTG Feed episodes:
An example of a HHGTTG episode:
As you can see it looks like a podcast but it's a bit bare-bones, so to speak. A description of each episode would be nice to have , but I am not too bothered about that at the moment. Perhaps if the mood takes me another time.
Round-up
A lot of bother? Not really. A lot of fun? Yes, absolutely! I've wanted to understand podcast feeds a bit better than I already did, and I wanted to play with LXD, and I wanted to try The Hitch Hikers Guide To The Galaxy. That's a triple success in my book.
I've listened to a few of the episodes, and everything is going swimmingly, for me at least. Poor old Marvin. I'll listen to the remaining episodes over the coming weeks. They are quite bizarre, but I enjoy them.
Until next time, take care!