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

Spread the love

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.

Installation

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.

Configure

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.

Using Pianobar

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.

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

Conclusion

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.

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox

Sign up for all newsletters.
By signing up, you agree to our Privacy Policy and European users agree to the data transfer policy. We will not share your data and you can unsubscribe at any time. Subscribe


Himanshu Arora

Himanshu Arora is a freelance technical writer by profession but a software programmer and Linux researcher at heart. He covers software tutorials, reviews, tips/tricks, and more. Some of his articles have been featured on IBM developerworks, ComputerWorld, and in Linux Journal.

Comments (1)