Ergonomic integration with keyboard commands

Although I am happy with the quality of the sound of volumio, I was disappointed with the
ergonomy. I wanted volumio as simple as my hifi system : push a button to power-it, a button
for the radio and the cd player,and select the source on the amplifer, that’s it.
Switchin on my computer, logging in, and opening a web browser
to control volumio is too heavy for me for day-to-day use.

My solution uses an old unused computer that I had at home, with a keyboard.
I now just have to switch on the current,
and volumio starts the radio. Then I type
a number 1,2,3…9 to get a different radio station, or letters for different operations
(c to cut-off the sound, x to e(x)plore the usb key with ncmpcpp, … ).

Before I explain the solution, the objectives:

  • simple things as simple as a standard hifi system
  • sophisticated things still possilble (exotic radios, spotify/qobuz…)
  • Possibility of switching on/off easily ( I don’t like to use current for things I don’t use).
  • Easy to explain to my partner

How to plug ?

The difficulty is that volumio needs a precise order to work properly: the dac needs to be powered before
volumio.

  • Power bar number one P1 plugged into the wall
  • In P1, plug:
    • the standard hifi system ( dac, amplifier, tuner )
    • a second power bar P2
  • In P2, plug:
    • an ethernet switch
    • the computer to control volumio
    • The screen for the computer
  • In the computer plug:
    • volumio on usb ( then it automatically starts with the computer)
  • In the ethernet switch, plug:
    • the computer
    • volumio
  • In the amplifier, plug:
    • the dac
    • the rest of your hifi components

For a nice looking installation, I hide the raspberry/volumio in the case of my computer.

To use the standard hifi system : switch on P1,plus your hifi system, plus select the appropriate source as usual.
In this configuration, the screen, the computer, the ethernet switch, the raspberry volumio are all switched off and take no current.

To use volumio: Switch on P1, then P2,the amplifier,the computer, plus select the dac source on the amplifier.

When volumio is on, the following operations are automatically done without user actions:
- the first radio is on
- the screen displays the available keystrokes:
- 1,2,3…9 for the french radio stations that I listen most of the time
- x to e(x)plore volumio (usb key, plus other radio stations already declared in volumio)
- c to cut-off the sound
- b to launch x(b)mc to access music on qo(b)uz

The software:

  • Installation of Lubuntu with auto-login : no need for a password after switching on. For this
    I needed to create a file ligthdm.conf with the good options.

  • At the login automatically start a terminal in full-screen which starts an interface program
    I personnally use fvwm as a window manager under linux, but this may be adapted to your window manager:
    in the init function, launch
    xterm -fullscreen -e “python nameOfTheInterfaceFileInYourSystem.py”

For the python program, I used curses, so that I can use single keys to control
volumio (no need to press the “Enter” key any more).

Below the python program, to be adapted to your needs.

Hope that helps.
Laurent.

[code]

import sys
import subprocess
import os
import curses

tableau={ 1:[“inter”,“http://mp3.live.tv-radio.com/franceinter/all/franceinterhautdebit.mp3”],
2:[“culture”,“http://mp3.live.tv-radio.com/franceculture/all/franceculturehautdebit.mp3”],
3:[“info”,“http://mp3.live.tv-radio.com/franceinfo/all/franceinfo.mp3”],
4:[“musique”,“http://mp3.live.tv-radio.com/francemusique/all/francemusiquehautdebit.mp3”],
5:[“fip”,“http://mp3.live.tv-radio.com/fip/all/fiphautdebit.mp3”],
6:[“nova”,“http://ice13.infomaniak.ch:80/radionova-high.mp3”],
7:[“BBC world”,“http://bbcwssc.ic.llnwd.net/stream/bbcwssc_mp1_ws-eieuk”],
8:[“BBC radio4”,“http://bbcmedia.ic.llnwd.net/stream/bbcmedia_intl_he_radio1_p?s=1421970783&e=1421985183&h=e05eb23fd27eeb6056966c1eb0c9f0ff”],
9:[""]
}

fenetre=curses.initscr()
curses.noecho()

def joueRadio(adresse):
subprocess.call([“mpc”,"-qh",“volumio”,“clear”])
subprocess.call([“mpc”,"-qh",“volumio”,“add”,adresse])
subprocess.call([“mpc”,"-qh",“volumio”,“play”])

def videPlaylist():
subprocess.call([“mpc”,"-qh",“volumio”,“clear”])

def lanceQobuzViaXbmc():
subprocess.call([“xbmc”, “2>/dev/null”, “1>/dev/null”])

def lanceNcmpcpp():
subprocess.call([“xterm”,"-fullscreen","-e",“ncmpcpp”,"-h",“volumio”])

def affichageAide():
ecran.addstr(“c :©ouper le son\n”)
ecran.addstr(“q :(q)obuz\n”)
ecran.addstr(“h :(h)elp, reafficher cette aide\n”)
ecran.addstr(“v :(v)olumio, explorer la cle USB sur volumio \n”)
ecran.addstr("\n")
ecran.addstr(“LA LISTE DES RADIOS \n\n”)
for key in sorted(tableau):
ecran.addstr(key+": “+tableau[key][0]+”\n")
ecran.refresh()

ecran = fenetre.subwin(0, 0)
#ecran.box()
ecran.refresh()

joueRadio(tableau[“1”][1])
affichageAide()

while True:
caractere=fenetre.getkey()
if (caractere==“c”):
videPlaylist()
elif (caractere==“q”):
lanceQobuzViaXbmc()
elif (caractere==“v”):
lanceNcmpcpp()
elif (caractere==“h”):
affichageAide()
else:
try:
adresseRadio=tableau[caractere][1]
joueRadio(adresseRadio)
except:
pass

curses.echo()
curses.endwin()[/code]