Neko

 
 

andj weblog

web log'n [not] for wimps

Follow | Followers | "Ídolos"

30 noviembre, 2008

Fun with headless music server

AndresVia @ 2:01 p. m.

Con una modificación a los archivos de eventos de acpi, puedo controlar la reproducción de la música en un equipo viejito que tengo por ahí (debajo de la cama), con un solo botón, mucho mejor escuchar música así que con el portátil cuyos parlantes apestan.

* Presionar dos veces: Next
* Presionar tres veces: Play/Pause
* Presionar cuatro veces: Vaciar la lista, agregar todo, mezclar y reproducir.

#!/bin/sh
# /etc/acpi/powerbtn.sh

# Skip if we just in the middle of resuming.
test -f /var/lock/acpisleep && exit 0

sh /etc/acpi/powerbtncount.sh &
---
#!/bin/sh
# /etc/acpi/powerbtncount.sh

#time sleeping before taking action
SLEEP=5s
MPD_HOST=localhost
COUNTFILE=/var/run/powerbtn-count
MPCPARAMS="--no-status"

if test \! -f $COUNTFILE; then echo 1 > $COUNTFILE; else {
  echo $((`cat $COUNTFILE`+1)) > $COUNTFILE
} fi

if test `cat $COUNTFILE` == 1; then {
  sleep $SLEEP
  COUNT=`cat $COUNTFILE`
  rm -f $COUNTFILE
  case $COUNT in
    1)
      ;;
    2)
      mpc $MPCPARAMS next
      exit 0
      ;;
    3)
      mpc $MPCPARAMS toggle
      exit 0
      ;;
    4)
      mpc $MPCPARAMS clear
      mpc listall | mpc add > /dev/null
      mpc shuffle $MPCPARAMS
      mpc play $MPCPARAMS
      exit 0
      ;;
    *)
      exit 0
      ;;
  esac
} else exit 0; fi

/sbin/shutdown -h now "Power button pressed"
last.fm/user/AndresVia

Etiquetas: , , , , , ,

#

Comentarios:  
is insane!!!
# Por: Blogger Unknown @ 2/12/08 9:02 p. m.  

Publicar un comentario

/home

Archivo

| noviembre 2005 | julio 2006 | agosto 2006 | septiembre 2006 | febrero 2007 | abril 2007 | octubre 2007 | noviembre 2007 | diciembre 2007 | enero 2008 | febrero 2008 | marzo 2008 | mayo 2008 | julio 2008 | agosto 2008 | noviembre 2008 | diciembre 2008 | enero 2009 | febrero 2009 | abril 2009 | junio 2009 | marzo 2010 |

Powered by Blogger