Installing Pianobar

From Projects Wiki
Revision as of 02:19, 19 July 2013 by Ralph Iden (talk | contribs) (Created page with "'''Installing Pianobar''' Submitted by Ed Schoolcraft <source lang="bash"> #!/bin/bash if [ $# != 1 ] ; then echo "usage: $0 your_pandora_username" exit 1 fi; if [ "$...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Installing Pianobar

Submitted by Ed Schoolcraft

#!/bin/bash

if [ $# != 1 ] ; then
	echo "usage: $0  your_pandora_username"
	exit 1
fi;

if [ "$UID" -ne 0 ]; then	#rerun this script as super user if not already a super user
    sudo $0	"$@"  #must pass any parameters back into the script
	exit 0
fi

my_pandora_username=$1;

apt-get install -y pianobar

mkdir -p /home/pi/.config/pianobar

cat > /home/pi/.config/pianobar/config <<DELIM
# This is an example configuration file for pianobar. You may remove the # from
 # lines you need and copy/move this file to ~/.config/pianobar/config
 # See manpage for a description of the config keys
 #
 # User
 user = $my_pandora_username
 #password = password
 # or
 #password_command = gpg --decrypt ~/password
 
# Proxy (for those who are not living in the USA)
 #control_proxy = http://127.0.0.1:9090/
 
# Keybindings
 act_help = ?
 act_songlove = +
 act_songban = -
 act_stationaddmusic = a
 act_stationcreate = c
 act_stationdelete = d
 act_songexplain = e
 act_stationaddbygenre = g
 act_songinfo = i
 act_addshared = j
 act_songmove = m
 act_songnext = n
 act_songpause = p
 act_quit = q
 act_stationrename = r
 act_stationchange = s
 act_songtired = t
 act_upcoming = u
 act_stationselectquickmix = x
 act_voldown = (
 act_volup = )
 
# Misc
 #audio_quality = low
 autostart_station = 123456
 event_command=/home/pi/.config/pianobar/scripts/eventcmd.sh
 fifo = /home/pi/.config/pianobar/ctl
 #sort = quickmix_10_name_az
 #love_icon = [+]
 #ban_icon = [-]
 #volume = 0

# Format strings
 #format_nowplaying_song = �[32m%t�[0m by �[34m%a�[0m on %l�[31m%r�[0m%@%s
 #format_nowplaying_station = Station �[35m%n�[0m
 #format_list_song = %i) %a - %t%r
 
# high-quality audio (192k mp3, for Pandora One subscribers only!)
 #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
 
DELIM

fingerprint=`openssl s_client -connect tuner.pandora.com:443 < /dev/null 2> /dev/null | openssl x509 -noout -fingerprint | tr -d ':' | cut -d'=' -f2` && echo tls_fingerprint = $fingerprint >> /home/pi/.config/pianobar/config

perl -i.bak -pe 's/^pcm.front cards.pcm.front/#pcm.front cards.pcm.front\npcm.front cards.pcm.default/g' /usr/share/alsa/alsa.conf

exit 0