How To: Install Pianobar on the Raspberry Pi

For those of you who aren’t acquainted with pianobar on the Pi yet, pianobar is a free/open-source console-based client for the online radio Pandora. Essentially it allows you to access Pandora via the command line and in doing so remove the resource intensive Flash Player from the equation. The interface is simple, intuitive and the navigation & playback were both very responsive. Pianobar by design is also a bit more flexible than it’s XBMC Counterpart.
For example: I can run pianobar from within my desktop environment, via command line, call it from scripts or voice-commands!

 

 

1.) First we need to make sure we are up to date:

 

2.) Then we need to install pianobar

 

3.) Next we will want to create our pianobar config file….

 

4.) Now we want to populate the config file that pianobar is going to use:
(Example Config file can be found /usr/share/doc/pianobar/contrib/config-example)

Make sure that you replace the user & password entries below with YOUR Pandora account information.

**Now would also be a good time to customize your keybindings or set your autostart_station.

 

**Note the tls_fingerprint at the end of the config file. The one listed in this config file is up to date and working as of today’s date. (4/1/2014) If you receive the below error when running pianobar:

(i) Login… Network error: TLS handshake failed.

Pandora has changed the certificate used for making a secure connection, in which case you will need to update it!

[learn_more caption=”To Update TLS cert…”]

 

User  r35krag0th over at Github has written a simple script to grab the latest key.

Simply create the script file like so:

sudo nano pandora_tls

 

Then to run it:

 

It should then return the latest TLS cert needed.
(In the below example I named my script ssl)

TLS_Pianobar_script

[/learn_more]

 

5.)  When all is said and done, you should be able to simply run:

pianobar

You should then be greeted by your list of radio stations….

Pianobar_Stations_Example

 

 

Additional Information:

 

  • If you are running a RetroArch Emulator (Like UltraSlim). You can easily create a script to run it from the /Roms/apps directory.
  •  Control Pianobar from your Android Phone w/ –  PianoBar Remote Control
  • Pianobar Man Page: HERE.
  • Pianobar Project Page: http://6xq.net/projects/pianobar/

 

 

If you have any questions /comments please share below.

 

  • John W. O’Brien III

    sudo bash ./pandora_tls
    2D0AFDAFA16F4B5C0A43F3CB1D4752F9535507C0

    ********

    Welcome to pianobar (2012.05.06)! Press ? for a list of commands.
    Login… Network error: TLS read failed.

    :/

    • ComJosh64

      The dreaded TLS error! I gave up on this problem a few months ago and finally came back to it when I picked up a Raspberry Pi B+. I have an Adafruit LCD keypad kit and had completed the Python Wifi Radio project found here -> https://learn.adafruit.com/pi-wifi-radio on a Pi Model B.

      I had hoped that starting from a clean, updated image of Raspbian would fix the problem. Nope.

      I followed the troubleshooting instructions for updating the tls_fingerprint to no avail. The problem for me wasn’t that the fingerprint had been updated, it was that the repository available through apt-get for Raspbian it not up to date (as of 8/17/14) so you must re-compile pianobar from the source-code.

      # Wait. Don’t freak-out!

      Re-compiling is a long process, but with a good walk-through you’re just copying commands. Your best bet is to remote in through an SSL connection to make it easy to copy and paste and so you’re not dedicating a monitor to the task. I took it a step further and used Screen:

      sudo apt-get update && sudo apt-get install screen

      to monitor the progress on a few machines, just start ”’screen”’ and log into the raspberry pi from another machine and using the
      screen -x
      command you can view the same command line on as many computers as you like!

      Why do you need to monitor it on multiple machines? Because it will take all day. Even using the “Medium” overclock settings on the new Pi (900Mhz) it took over 6 hours to complete. I’m not sure exactly how long it took because I was doing other things around the house while I waited.
      This tutorial -> http://www.lanmaster53.com/2014/05/raspberry-pi-pianobar/
      is the best I’ve found, and I was able to bring my Wifi Radio back to life using it!

      Best of luck!

      P.S.

      As a side note regarding the Raspberry Pi Model B+: The hardware changes (extra USB, power management, and combined audio / composite video jack) break the firmware on the old distributions of NOOBS. You will not have a keyboard / mouse until Raspbian boots. So go ahead and download the newest version. You’ll need it to play with
      Sonic Pi -> http://www.cl.cam.ac.uk/projects/raspberrypi/sonicpi/
      anyway.

  • Pingback: Setting up Pianobar with Raspberry -Pi | ypag()

Pin It on Pinterest