News & Updates
Pianobar: No-ads Pandora client
Article # 521 January 17th, 2012
Pianobar is a a free/open-source, console-based replacement for Pandora’s flash player.
For Ubuntu OS and many linux users, it provides you with all the same features and functions as the web based Pandora client, but with some really nice differences, and simple controls – and NO COMMERCIALS. Sorry Windows users, you’re SOL.
There is a version of pianobar for Mac OS X, and you can learn about it here.
Most of the features Pandora’s flash client has are implemented in the Pianobar terminal client. This means you can create, delete and rename stations.
Adding and removing artists or songs to/from a station is also possible through the easy to navigate menu options. Music tracks can be rated, temporarily banned and moved to another station. Sending the artist and song title information to last.fm (“scrobbling”) is possible with the eventcmd interface, which you can learn more about in another article. For now, let’s simply get it installed, and playing for you so you too can begin enjoying music while you read my other articles here on musiccityguru.com
Downloading pianobar (and installing it)
To obtain pianobar, the best and most effective way is to add the Pianobar deb repository to your /etc/apt/sources.list file – this provides you with an easy way to maintain Pianobar when changes or updates occur. Open a terminal window and edit your /etc/apt/sources.list file:
$ sudo vim /etc/apt/sources.lst
Add the lines shown below anywhere in the file (I added mine at the bottom).
#pianobar distribution deb http://ubuntu.mirror.cambrium.nl/ubuntu/ oneiric main universe
Save the file, and simply update your apt-get:
$ sudo apt-get update -f
Once your update has completed, just use apt-get to install it, and you’re ready to begin using pianobar (in simple mode):
$ sudo apt-get install pianobar
If all goes well, you’ll be smiling. But, you’re not done yet, if you’re any kind of a nerd like me. You see, pianobar reads a configuration file for username and password information that it needs to log in to your Pandora account. If you don’t have a Pandora account, now is a good time to create one. Otherwise, proceed as shown below to setup the configuration file. To run your newly installed pianobar, and login, just activate it from the terminal window:
You will be prompted for your (Pandora) username (email address) and password which is your Pandora account login and password. I don’t like having to provide this EVERY time I run pianobar, so being the lazy slob that I am, I worked up the configuration file to perform all the actions for me. I run it, it logs me in and begins playing a pre-configured channel I like to listen to. WHAT GREAT FUN!
Git users can download the latest installation version available here: https://github.com/PromyLOPh/pianobar.git
git clone https://github.com/PromyLOPh/pianobar.git
To install on Ubuntu >= 12.04 sudo apt-get install libao-dev libmad0-dev libfaad-dev libgnutls-dev libjson0-dev libgcrypt11-dev make sudo make install
Be sure all of the above packages are installed, if you have to, install them one at a time.
I had to then move the exec file to /usr/bin
sudo cp pianobar /usr/bin sudo chown root. /usr/bin/pianobar
Install Scrobbler-helper for LastFm
Visit http://askubuntu.com/questions/17482/how-do-i-set-up-last-fm-scrobbling-with-pianobar for more instructions on installing and configuring Scrobbler-helper for LastFm.
# sudo perl -MCPAN -e 'install Audio::Scrobbler'
Follow the prompts to complete installing the Audio:Scrobbler program which will provide the vehicle to send your song playing to Last.FM account.
Configuring pianobar (the cool stuff)
Download PianoBar Config File – Download a sample config file for your pianobar.
When it starts up, Pianobar always looks for a file named config in the ~/.config/pianobar directory and reads it’s contents for additional information at runtime. So, create that directory from your home directory and create the config file:
$ mkdir ~/config/pianobar $ cd pianobar $ gedit config
Just load the file into your editor of choice (gedit/vim) , make your edits and uncomment out lines, change the parameters for user and password to your Pandora account.
For now, I would comment out the event_command= line unless you know what your doing and want to perform scrobbling to a music site like last.fm (sorry, it’s beyond the scope of this article) When your finished, just save your changes, and set the config file to be readable by all:
$ chmod 0777 config
Then run it from the command line and you’ll get a screen similar to this: (versions may vary depending on when you’re reading this and the latest version available in the repository).
Then, sit back and let this little great app keep your toes tappin and your mind flowing at your UBUNTU powered (FREE) computer!
When Pandora changes their protocol, which I have found they do, an update to the pianobar repository is usually quick to follow, so you might have to perform a few things to get it working when you get an error.
You’ll want to visit GitHub for the latest version here.
It took me a while to finally get things working with this new version because of the major changes in pianobar, and hope to do it again on my home machines.
Pianobar changed the way they communicate with Pandora, and thus, the following package had to be installed before I could get it working again:
sudo apt-get install libgnutls-dev
Then, I downloaded the very latest version of pianobar:
Now enjoying pianobar again, until next time Pandora changes their protocol…
Update for Pianobar
Pianobar has changed thier tls_fingerprint info, so if your pianobar config fails to work because of the “TLS handshake error” – add this line to you config file:
tls_fingerprint = 2D0AFDAFA16F4B5C0A43F3CB1D4752F9535507C0