Skip to main content

Pandora and LastFM From a Terminal Window

multimedia audio music saas

We’re used to accessing multimedia content on the net through our web browsers. The browser makes sense when you’re viewing video like YouTube. However, it can be overkill for listening to a music station. There are a couple of excellent Linux applications that you can run from a terminal window. They also consume fewer resources, making them perfect for lower end hardware. Plus, they can even filter out the periodic ads, giving you a commercial-free listening experience.

Pianobar is a client for the Pandora music service. Shell FM does the same for Last.FM. Both are straightforward to install for those who are comfortable with the command line.

Pianobar screenshot
Pianobar running from a terminal window

Pianobar Installation
#

The README file says you’ll need some development packages before you can build Pianobar. In Ubuntu 9.04, I installed the following with Synaptic or apt-get:

git-core
cmake
libao-dev
libfaad-dev
libmad0-dev

Create a home directory for the source code, and download it:

cd ~/src
git clone git://github.com/PromyLOPh/pianobar.git

Then build and install it, watching for errors:

cd pianobar
cmake . (note: don't forget the period)
make
sudo make install

Running Pianobar
#

Just type pianobar <Enter>. You’ll be prompted for your Pandora.com username and password, then shown a menu with your stations. Press the “?” key at any time to show the available commands.

Avoid having to type your login information by storing them in the configuration file. Edit ~/.config/pianobar/config:

user = your-account-email-address
password = your-password

Pianobar may time out after a few hours if you don’t touch it. This is fair. While Pandora may not know that your client isn’t using a web browser and viewing its ads, the service pays royalties to the record industry and needs some way to control use. Moreover, they may be doing you a favor by preventing you from using up your free hours if you walk away from the computer and forget it’s still running.

Upgrades to the Pandora service or to the library dependencies may break Pianobar. This problem is easily fixed. A symptom is a message like this when you start up:

(i) Login... Error: Protocol incompatible. Please upgrade libpiano.

The fix may as easy as recompiling the old source code using newer libraries already on your computer. Try re-doing the installation steps above starting with “cmake”. If that fails, you may need to grab the latest source code, and repeat the install (move your old source code directory first).

Shell-FM Installation
#

You know the drill by now. Get the latest source code with git, similar to the steps above for Pianobar:

cd ~/src
git clone git://github.com/jkramer/shell-fm.git

Build and install:

cd shell-fm
make
sudo make install

Running Shell-FM
#

Type shell-fm <Enter>. After your first use, look for or create the file ~/.shell-fm/shell-fm.rc. The Tux Wears Fedora site shows you an example configuration. The key lines are:

username = your-user-name
password = your-password
default-radio = lastfm://user/your-user-name/your-station-name

Shell-fm screenshot
The shell-fm terminal window

See the manual (man shell-fm) for more parameters and settings. Advanced users may want to look at the scripts subdirectory of the source code for examples of remote controlling the app.

Wrapping Up
#

They’re very plain looking, but that’s the point. If you think a good music player should be heard and not necessarily seen, Pianobar and LastFM may be for you.

Related

Dokuwiki: Small Footprint, Big Features
server apps wiki
Wikis are a valuable business tool.