Use Pianobar to Listen to Pandora From the Linux Command-line

If you are one of those command line geeks who like listening to music while doing work, you’ll be thrilled to know that Pandora, the popular Internet radio service, can be accessed through command line as well. There exists an open source command line Pandora client by the name of Pianobar, which makes it possible.

The command line application provides the following features:

  • Play and manage (create, add more music, delete, rename, …) stations
  • Rate songs and explain why they have been selected
  • Upcoming songs/song history
  • Customize keybindings and text output
  • Remote control and eventcmd interface (send tracks to last.fm, for example)
  • Proxy support for listeners outside the USA

In this article, we will discuss how to install, configure, and use the command line application on Linux.

If you’re running Debian, or a Debian-based system (like Ubuntu, Mint, and more), you can easily install Pianobar by running the following command:

sudo apt-get install pianobar

But if you’re using some other distribution, or the application is not available in your distribution’s repositories, you can download its source code and build it from scratch. The source code is available on GitHub.

Once Pianobar is successfully downloaded and installed, the next step is to configure it. Although you can run the app right away by running the pianobar command, you’ll probably get frustrated as you’ll have to enter the login credentials every time the command is run.

To configure the application, first create the “config” directory using the following command:

mkdir -p .config/pianobar

Then navigate to the new directory and create a configuration file called “config”

cd ~/.config/pianobar
touch config

Open the newly created “config” file, and enter the following information:

user = [your-pandora-username]
password = [your-pandora-password]
audio_quality = high

Replace the square brackets and the text within them with your Pandora username and password. As for “audio_quality”, other available values are “medium” and “low.”

Another point worth mentioning is that you cannot access Pandora outside of the US. So, if you are trying to access Pandora from a location other than the US, add the following line to your config file as well:

control_proxy = http://xxx.xxx.xxx.xxx:[port]

Replace xxx.xxx.xxx.xxx with a US proxy ip address, and [port] with a port number. For example, I used 205.218.11.176 as proxy IP and port number 80.

This is the most basic configuration. For more configuration options, refer to Pianobar’s man page.

Once you’ve configured the application, it’s very easy to use; just run the following command:

pianobar

The application will login into Pandora service, fetch the stations and ask you to select one. Once done, it will fetch the corresponding play list and start playing the songs.

pianobar

The application also provides various commands through which you can do stuff like create a new station, delete a station, and more. Here is the complete list of commands (which you can get on console by pressing ?):

  • + – love song
  • – ban song
  • a – add music to station
  • c – create new station
  • d – delete station
  • e – explain why this song is played
  • g – add genre station
  • h – song history
  • i – print information about song/station
  • j – add shared station
  • n – next song
  • p – pause/resume playback
  • q – quit
  • r – rename station
  • s – change station
  • t – tired (ban song for 1 month)
  • u – upcoming songs
  • x – select quickmix stations
  • b – bookmark song/artist
  • ( – decrease volume
  • ) – increase volume
  • = – delete seeds/feedback
  • v – create new station from song or artist
  • P – resume playback
  • S – pause playback
  • ^ – reset volume

While Pianobar will most likely appeal to hardcore command line users, it’s also a useful alternative if you’re looking for a Pandora client that’s not a resource hog, although it might take time for you to get used to it. Have you used Pianobar? How was your experience? Do you use any other command line Pandora client? Let us know in the comments below.