Last active
November 17, 2016 23:12
-
-
Save ldante86/eb8065b822f8a643158eb9ba4dd26469 to your computer and use it in GitHub Desktop.
connect to pandora service with pianobar
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash - | |
# SCRIPT: pandora.sh | |
# AUTHOR: Luciano D. Cecere | |
# YEAR: 2014 | |
# | |
# Connect to pandora service through pianobar | |
# Requires pandora account. | |
pandora=/usr/bin/pianobar | |
pandora_path=~/.config/pianobar | |
pandora_username='' # required | |
pandora_password='' # required | |
if ! which $pandora >/dev/null | |
then | |
printf "%s\n" "$pandora is not installed" 2>/dev/null | |
exit 1 | |
fi | |
if [ ! -d $pandora_path ] | |
then | |
mkdir -p $pandora_path | |
fi | |
cd $pandora_path | |
if [ ! -f config ] | |
then | |
touch config | |
fi | |
if [ ! -p ctl ] | |
then | |
mkfifo ctl | |
chmod 777 ctl | |
fi | |
if [ -z "$pandora_username" ] || [ -z "$pandora_password" ] | |
then | |
printf "%s\n" "pandora_username and/or pandora_password not set" 2>/dev/null | |
exit 1 | |
fi | |
tls=$(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 = $tls" > config | |
gnome-terminal --tab -e $pandora | |
echo $pandora_username > ctl | |
echo $pandora_password > ctl | |
# To start pianobar on station 12: | |
#echo '12' > ctl |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment