I'm writing an Android app to remotely control pianobar
(running on the RPi, for example) over a Wi-Fi connection. Pianobar
is an unofficial Pandora Radio client that is easy to setup with a proxy to listen to Pandora from anywhere in the world (see Pandora anywhere
for information about setting up pianobar outside the USA/Australia/New Zealand).
for information about the functions that the app supports.
The app is and always will be completely free as well as ad-free,
but a small donation
is much appreciated! The source code is not available for now, but
if/when I have time to tidy it up a bit I'll probably release it.
Mainly tested on Android 2.3.6 (should work on 2.3+). Here are some screenshots
(Creds to Naeki-Design@deviantart for icons and Ed for beta testing):
Pianobar was never made for being remotely controlled and the solution isn't the very prettiest, but it does work
fairly well in it's current state and I'm still
developing it to improve it's functions further.
If anyone is interested in helping out with the development, please contact me
Feel free to ask any questions if you have any problems/suggestions/comments as well.
The solution (FIFO over SSH) itself isn't the prettiest. Pianobar wasn't made for being remotely controlled
The progress bar is a bit slow (misses a second every now and then)
Not possible to delete a single server at a time (only all at once) from the server list (login screen)
(130809) v. 1.5.5 Bug fix: volume control would control ringer volume
(130729) v. 1.5.4 New feature: share current song (on Facebook for example), use the menu button
(130729) v. 1.5.4 Clear build up of ctl commands on shutdown if pianobar crashes
(130729) v. 1.5.4 Check for lost SSH connection (shouldn't happen often)
(130729) v. 1.5.4 Better layout for tablets (limited testing, report issues)
(130729) v. 1.5.4 Possible fix for re-login on screen rotate on Android 3.2+
(130724) v. 1.5.3 ProgressDialog instead of toast on long-running commands
(130724) v. 1.5.3 Proper closing of ssh connections on back + several minor bug fixes
(130719) v. 1.5.1 Change title to current server after logging in
(130719) v. 1.5.1 Bug fix for auto-pause
(130719) v. 1.5.0 Multiple servers support (see Usage
(130719) v. 1.5.0 Possible fix for crash after (sometimes) losing Wi-Fi connection
(130715) v. 1.4.4 Bug fix: fixed a bug that caused the love symbol not to turn red
(130611) v. 1.4.3 Bug fix: fixed a bug that caused major CPU usage in paused state
(130611) v. 1.4.3 Retry dialog on unsuccessful re-login attempt
(130404) v. 1.4.2 Bug fix: fixed a bug that caused playback to be paused after canceling some dialogs
(130328) v. 1.4.1 New feature: get localized buy links for current album from last.fm (the magnifying glass)
(130328) v. 1.4.1 A couple of bug fixes, nicer requests to last.fm
(130326) v. 1.4 NOTE!
New event command file (copy from below) is necessary for version 1.4+ to function well
(130326) v. 1.4 New feature: Create stations from genres
(130326) v. 1.4 New feature: Display current album
(130324) v. 1.3.5 Button text changed on SSH login to make it more clear that the app will start pianobar
(130324) v. 1.3.5 Minor bug fix with the progress bar
(130321) v. 1.3.4 Several bug fixes. Proper handling of all network activity (= more stable)
(130320) v. 1.3.3 Bug fix: station list wouldn't work properly on (some?) Android 4 devices, should work now
(130320) v. 1.3.3 Port number check on SSH login screen
(130316) v. 1.3.2 Better shutdown function and error handling
(130305) v. 1.3.1 Several bug fixes
(130301) v. 1.3 New feature: create station from currently playing artist or song
(130301) v. 1.3 Bug fix: fixed a layout issue with the progress bar on some devices
You can download the app here
here if you are using an Android phone
(or here for an off-market apk
Required permissions are Network Communication (to connect to pianobar, fetch cover art etc.) and Phone Calls (to automatically pause on incoming phone call).
In order for the app to work you need to have an SSH server up and running on the music server,
this is installed and set up as default on a Raspbian distro and the login details in the app
are pre-set for Raspbian, but you can of course use any Linux distro. If your server is on a different system
you need to get SSH working and change the login details when you start the app, contact
with information about your server if you need help setting it up.
The app works for pianobar running under
Mac as well, install pianobar
with MacPorts/Homebrew and follow the instructions below. Pianobar running under Cygwin/Windows does not seem to support
event commands, which is required for the app to function, due to fork() failures
there doesn't seem to be any possibility to use it with Windows (thanks Gary!). If someone has been able to compile pianobar
under Cygwin with functioning event commands let me know!
Install pianobar on the server, for Debian based distros - open up a terminal (shell) and write:
sudo apt-get install pianobar
Then set up a config file for pianobar (create the pianobar folder if it doesn't exist with "mkdir ~/.config/pianobar"):
Add the following lines, the login details (to Pandora) are necessary for the app to function, as well as the full path
to the event command file (change the username "pi" to suit your setup). See "man pianobar" for other options:
tls_fingerprint = 2D0AFDAFA16F4B5C0A43F3CB1D4752F9535507C0
user = email@example.com
password = mypassword
event_command = /home/pi/.config/pianobar/eventcommand.sh
Then just run the following command to download the eventcommand file (part of the code has
been taken from Bruce Connors work with control-pianobar
), make it executable and make the fifo:
cd ~/.config/pianobar && wget http://raspberrypiserver.no-ip.org/eventcommand.sh && chmod +x eventcommand.sh && mkfifo ctl
If you want you can test the setup by running the command "pianobar". You should get a message that says:
(i) Control fifo at /home/user/.config/pianobar/ctl opened
(i) Login... Ok.
(i) Get stations... Ok.
NOTE! Pianobar should not be started manually when you use the app (some functions won't work),
after logging in the app will start pianobar automatically (unless it's already running).
NOTE 2! If you are running pianobar on a Mac (haven't had any reports regarding this issue with Linux) computer
and pianobar doesn't start up after login even if everything is setup according to the instructions above,
edit your ~/.bashrc file and add/edit the line:
export PATH=$PATH:[path to pianobar install directory]
where [path to pianobar install directory] is normally /usr/local/bin (thanks Dylon!)
NOTE 3! If you get a TLS error when starting pianobar it is likely to be caused by an old version of pianobar
still in some repositories. Install the latest git version
(first three steps for a normal Pandora account) instead.
If you are connecting through a proxy it can also be caused by a non-working server.
If you have a Pandora One account (for 192kbit MP3)
you need to download the latest version of pianobar
from the git repository:
git clone https://github.com/PromyLOPh/pianobar.git
Install the dependencies:
sudo apt-get install libao-dev libmad0-dev libfaad-dev libgnutls-dev libjson0-dev libgcrypt11-dev
Go to the folder that pianobar was copied to (default is "cd ~/pianobar")
make && sudo make install
NOTE! Do NOT set up pianobar as root ("sudo make").
Then add this to your config file (remove any double entries, like the tls_fingerprint if you have set it up before):
audio_quality = high
rpc_host = internal-tuner.pandora.com
partner_user = pandora one
partner_password = TVCKIBGS9AO9TSYLNNFUML0743LH82D
device = D01
encrypt_password = 2%3WCL*JU$MP]4
decrypt_password = U#IO$RZPAB%VX2
tls_fingerprint = B0A1EB460B1B6F33A1B6CB500C6523CB2E6EC946
Pandora is, at the time of writing this, only available in the USA, Australia and New Zealand.
With pianobar it is possible to listen to Pandora from anywhere in the world. Start by making
an account at Pandora.com
. For the registration process
you will need to connect through a proxy, there's an extension for Chrome and Firefox
called Media Hint
, which will make the process easy.
Just install it and browse to Pandora. You will also have to enter a US zip code (any zip code will work...).
When you play music with pianobar you need to connect through a proxy server as well,
if you don't have one of your own (one option
is to get a US based web server and run PHPProxy
) you can
check out Hide My Ass
for lists of free proxies,
and add this line to the pianobar config file (change the numbers to a working proxy server):
control_proxy = http://165.225.xxx.xxx:80
Use the menu button on your device to add a new SSH server (pianobar player) or to delete all saved servers (it's not possible
to delete a single server, at least for now). Long press on a server in the server list to edit the name/login details.
Click on a server in the server list to connect to it and start pianobar (unless it's already started).
After you have
logged in you can use the back button on your device to go back to the server list without shutting down pianobar (= control
several instances of pianobar running on different servers).
The app is and always will be completely free as well as ad-free,
but a small donation is much appreciated!