Credit : dexter :
http://forum.doozan.com/read.php?2,2471,28702#msg-28702
Pianobar control from USB keypad notes.
1. get pianobar installed and working. apt-get install pianobar. Use your existing Pandora account or create a new account.
2. for some reason these packages may also be needed: alsa-utils, kbd, psmisc, screen, openssl.
3. To get the usb sound card to work, create /etc/modprobe.d/alsa-base.conf to read: options snd_usb_audio index=0
4. 'aplay -l' will verify if the usb sound card is device 0.
5. There is a 19 digit number shown for each pandora station when playing. Modify /root/.config/pianobar/config to read:
tls_fingerprint = 13CC51AC0C31CD96C55015C76914360F7AC41A00
audio_quality = low
autostart_station = 19digityourfavorite
password = yourpianobarpassword
user = yourpianobarlogin@emailaddress
6. tls_fingerprint may change. to get new tls_fingerprint, run shell script from
https://gist.github.com/r35krag0th/4173333
7. To get pianobar running as a service, add pianobar script to /etc/init.d/ from
https://www.raspberrypi.org/forums/viewtopic.php?t=31399&p=276550
8. run 'update-rc.d pianobar defaults'
9. verify that pianobar can be started and stopped by 'service pianobar start', 'service pianobar stop'
10. Install inputlirc and lirc, and configure as documented earlier in this thread.
11. Use irw to verify keypresses for your USB keypad. I have 2 different keypads and they have different responsed to keypresses. Numlock status also makes a difference. I use 2 digits plus enter for each command, but other setups should work as well. Adding & to the end of the command puts it in the background so other commands (stop or killall) can be entered.
12. I use this command to start pianobar using 99<enter>:
begin
button = KEY_KP9
button = KEY_NUMLOCK
button = KEY_NUMLOCK
button = KEY_KP9
button = KEY_NUMLOCK
button = KEY_KPENTER
repeat = 0
prog = irexec
config = service pianobar restart &
end
13. I use this command to stop pianobar and also vlc using 00<enter>:
begin
button = KEY_KP0
button = KEY_NUMLOCK
button = KEY_NUMLOCK
button = KEY_KP0
button = KEY_NUMLOCK
button = KEY_KPENTER
repeat = 0
prog = irexec
config = killall -9 vlc pianobar &
end
14. To switch between pianobar stations, I make a separate config file for each, and after stopping pianobar, I copy the config file of the desired station over the previous config file, then restart pianobar:
begin
button = KEY_KP1
button = KEY_NUMLOCK
button = KEY_NUMLOCK
button = KEY_KP2
button = KEY_NUMLOCK
button = KEY_KPENTER
repeat = 0
prog = irexec
config = cp /root/.config/pianobar/config.blacksabbath /root/.config/pianobar/config
end
15. I also use the keypad to play mp3 music from local or network folders using vlc, and also play internet radio streams, also using vlc.
begin
button = KEY_KP0
button = KEY_NUMLOCK
button = KEY_NUMLOCK
button = KEY_KP4
button = KEY_NUMLOCK
button = KEY_KPENTER
repeat = 0
prog = irexec
config = cvlc -Z /media/usb0 &
end
begin
button = KEY_KP8
button = KEY_NUMLOCK
button = KEY_NUMLOCK
button = KEY_KP0
button = KEY_NUMLOCK
button = KEY_KPENTER
repeat = 0
prog = irexec
config = cvlc
http://news-stream.iowapublicradio.org/News.mp3 &
end
Edited 2 time(s). Last edit at 06/20/2016 07:49AM by Gravelrash.