Streaming Pandora with Pianobar on QubesOS

The other day Kris Nóva was
broadcasting her effort to get pianobar working. Pianobar
is a Pandora radio CLI application written in C.

Typically my day is filled with some lo-fi hip hop streamed from YouTube. But the constant ads and “Video Paused.
Click to continue” prompts are quite annoying. The idea is to have some chill background music not something that
requires constant petting throughout the day, when I found out about pianobar I had to get it going.

My setup is a bit different than Kris’, I run QubesOS, so things like this end up in their own VM. This is a short
overview of how I’ve set this up to have instant radio in a terminal with no more ads / prompts. You’ll need a
pandora account and a Qubes install to follow along.

QubesOS Methodology

I won’t go into incredible details on Qubes, but the basic concepts are:

App VM: App VMs use a Template VM for the base system and have persistent storage for your particular settings

Since I use the standard template VMs to reduce the attack surface and supply chain risk for my clients, they’re kept quite
pristine and don’t have any software on them that isn’t from the official repositories. Rather than compile Pinanobar, I decided
to use the Fedora RPM Fusion packages. This requires a new template VM with the fusion repositories added so that our standard
fedora-30 Template VM isn’t tainted (no slight implied here, that’s just how I roll).

New TemplateVM

We’ll clone the existing fedora-30 VM so we don’t modify the original, other VMs use that template.

Run the following in a Dom0 terminal

qvm-clone fedora-30 fedora-30-fusion
qvm-run fedora-30-fusion xterm

This should provide you with a barebones xterm that we’ll use to install pianobar from the fusion repositories.

Pianobar Config

By default, pianobar will prompt you for your credentials on startup. We want this to be automated so we have a single click
music system.

In the personal-radio xterm that we started, you should be able to run pianobar and login. To have that automated for us,
we’ll create a config file.

mkdir ~/.config/pianobar
vi ~/.config/pianobar/config

For complete pianobar configuration details, see man pianobar. I use pass with split-gpg
to secure my password, but you can put any command in the password_command, or, specify the password plaintext.

audio_quality = high# station IDs can be displayed by pressing i in pianobar when a song is playingautostart_station = 4541690573152710643user = [email protected]password_command = pass services/pandora/[email protected]#password = dobetter

Save this file and then run pianobar again. It should automatically log you in and start playing the Electronic
Ambient Radio station.

Shutdown the personal-radio VM via shutdown -h now from the personal-radio terminal or qvm-shutdown personal-radio from the Dom0 terminal.

Launch the personal-radio VM, pianobar should run, login, and start playing all on it’s own.
qvm-start personal-radio from a Dom0 terminal.

Vince Hillier is the President and Founder of Revenni Inc.
He is an opensource advocate specializing in system engineering and infrastructure. Outside of building solid architecture that doesn't break the bank, he's interested in information security, privacy, and performance.