NCurses Internet Radio Player

Since moving house last year, I've found myself unable to receive Saorview (Irish DVB-T) using an indoor aerial (my new house is about 10km further from the transmitter). This was previously my primary way of receiving the RTÉ Radio stations when working on my desktop. I have a high gain wideband antenna in the attic which works great, but with no neat way to get a cable to my desktop, this is unfortunately not an option..

I had a look around for terminal-based internet radio players but could find none packaged within Debian, which I found a bit surprising. I came across pyradio, but I found it a bit clunky. Nevertheless, it is still an improvement on RTÉ's horrible Flash-based web player. I figured I could do better, and remembered VLC's nifty NCurses interface; which is ideal for my requirements.

I've collated the IceCast m3u streams from RTÉ and other Irish stations into a XSPF playlist and placed it on Github. By opening this playlist within VLC, we get a pretty clean terminal interface for playing my radio stations:
vlc -I ncurses --no-color /path/to/radio_playlist.xspf


DVB-T on Linux using DVBStreamer

I've tried most of the DVB streaming solutions for Linux, including VDR, MuMuDVB, DVBBlast, dvbstream, DVBStreamer, GNOME DVB Daemon. I've only managed to find one that does this well though, which is DVBStreamer.

Getting started with DVBStreamer is pretty easy. First of all you need a DVB adapter that works with Linux. I use a USB ITE IT913x-based adapter, which works well for me.

Once you have a compatible package, you need to install necessary (Debian/Ubuntu) packages:
apt-get install dvb-tools dtv-scan-tables dvbstreamer vlc

Use the scan tool to create a DVB channel configuration file using the DTV initial scan file for your nearest transmitter. I'm based in Dublin, Ireland, so I've used my nearest DVB-T transmitter, Three Rock in this example:
scan /usr/share/dvb/dvb-t/ie-ThreeRock > /tmp/channel.conf

Once you have your channel.conf file, you can pass this to setupdvbstreamer which creates the necessary DVBStreamer config files:
setupdvbstreamer -t /tmp/channel.conf

Create a startup file to auto tune to LCN 2 to on startup and output some useful DVB-T information. LCN 2 currently corresponds to RTÉ Two HD on Saorview:
printf "set udp://localhost:1234\nselectlcn 2\nfeparams\nfestatus\nstats\nlslcn\n" > ~/.dvbstreamer/dvbstreamer.conf

Now you can start DVBStreamer using the following:
dvbstreamer -f ~/.dvbstreamer/dvbstreamer.conf

DVBStreamer is now streaming over UDP to localhost:1234. You can view this using vlc:
vlc udp://@localhost:1234

I don't like keeping a terminal open just to run DVBStreamer, so usually I start it in daemon mode by passing '-f -d' at startup, and control it using the remote interface to control instead:
telnet localhost 54197

Linux Kernel Contributor

Having used GNU/Linux systems for some time now, and having submitted patches to a fair number of open source projects, it is nice to finally get a patch accepted into the biggest open source project of them all, the Linux kernel. While I did submit a kernel patch to OpenWrt back in 2011, it is maintained as a rebased patchset, and was never upstreamed to Linus' tree.

That changed today though, when a small patch I (had forgotten I had) sent to the linux-media mailinglist back in October 2013, was just pulled by Linus Torvalds into his tree for the Linux 3.13-rc4 release; so I'm now proud to be able to call myself a contributor to the Linux Kernel. :-)


recode is a simple program for performing conversions between many different character sets.

I often use it to encode HTML and other code snippets before uploading them to the web.

jmccrohan@lambda:~$ echo '<strong>Hello, World!</strong>' | recode utf8..html
&lt;strong&gt;Hello, World!&lt;/strong&gt;

XML reindent

XML is designed to be human-readable. However, to minimise data transfer, the indentation and newline characters are often discarded during transmission. This results in a difficult-to-read XML file such as the one below:

<?xml version="1.0" encoding="ISO-8859-1"?><note><to>Tove</to><from>Jani</from>
<heading>Reminder</heading><body>Don't forget me this weekend!</body></note>

This XML file can be both checked for validity, and reindented using xmllint. Debian/Ubuntu users can find this as part of the libxml2-utils package.

xmllint --format input.xml > output.xml

This results in the following, more-sane output:

<?xml version="1.0" encoding="ISO-8859-1"?>
  <body>Don't forget me this weekend!</body>