Tuesday, May 23, 2006

mpd && asus hotkeys REVISITED

#!/bin/bash

###############
MPD_URL="localhost"
MPD_PORT="6600"
###############

function xecho() {
echo "$1" | osd_cat --font="-adobe-helvetica-bold-*-*-*-34-*-*-*-*-*-*-*" --shadow=2 --pos=top --align=center --colour=yellow --delay=2
}

function send_command_to_mpd () {
echo $1 | nc -q1 $MPD_URL $MPD_PORT
}

function get_current_song() {
filename=`send_command_to_mpd currentsong | grep "file: " | sed -e 's/file: //'`
artist=`send_command_to_mpd currentsong | grep "Artist: " | sed -e 's/Artist: //'`
title=`send_command_to_mpd currentsong | grep "Title: " | sed -e 's/Title: //'`

if [ "$artist-$title" == "-" ] ; then
echo $filename
else
echo "$artist -- $title"
fi
}

function mpd_status () {
status=`send_command_to_mpd status | grep "state:" | sed -e 's/state: //'`
case $status in
play ) echo play ;;
pause ) echo pause ;;
stop ) echo stop ;;
* ) echo unknown ;;
esac
}

case "$1" in
play_pause )
case `mpd_status` in
play ) send_command_to_mpd pause && xecho "`get_current_song`" ;;
pause ) send_command_to_mpd play && xecho "`get_current_song`" ;;
stop ) send_command_to_mpd play && xecho "`get_current_song`" ;;
esac ;;
stop ) send_command_to_mpd stop && xecho "`get_current_song`" ;;
next ) send_command_to_mpd next && xecho "`get_current_song`" ;;
previous ) send_command_to_mpd previous && xecho "`get_current_song`" ;;
* ) exit 1;;
esac

exit 0

asus_acpi events

I forgot asus_acpi events :S

gutter@giskard ~/.asus_acpi/events $ for list in `ls mpd*`
> do echo Filename: $list
> cat $list | grep -v \# | grep -v -e "^$"
> done

Filename: mpd_next
event=hotkey.*41[[:space:]].*
action=~/.asus_acpi/mpd.sh next
Filename: mpd_play_pause
event=hotkey.*45[[:space:]].*
action=~/.asus_acpi/mpd.sh play_pause
Filename: mpd_previuos
event=hotkey.*40[[:space:]].*
action=~/.asus_acpi/mpd.sh previous
Filename: mpd_stop
event=hotkey.*43[[:space:]].*
action=~/.asus_acpi/mpd.sh stop

"Incontro a Farpoint" (TNG), data astrale 41153.7


McCoy: Non vedo punte sulle tue orecchie, ragazzo, ma tu parli come un Vulcaniano.
Data: No, signore. Io sono un androide.
McCoy: Beh, siamo li'...
-- "Incontro a Farpoint" (TNG), data astrale 41153.7"

Monday, May 22, 2006

mpd && asus hotkeys

A bunch of bash lines in order to use mpd in combination with Asus hotkeys.

This sript requires: netcat, xosd, asus_acpi and mpd ;).

#!/bin/bash

###################
MPD_URL="localhost"
MPD_PORT="6600"
###################

function xecho() {
echo "$1" | osd_cat --font="-adobe-helvetica-bold-*-*-*-34-*-*-*-*-*-*-*" --shadow=2 --pos=top --align=center --colour=yellow --delay=2
}

function send_command_to_mpd () {
echo $1 | nc -q1 $MPD_URL $MPD_PORT
}

function get_current_song() {
filename=`send_command_to_mpd currentsong | grep "file: " | sed -e 's/file: //'`
artist=`send_command_to_mpd currentsong | grep "Artist: " | sed -e 's/Artist: //'`
title=`send_command_to_mpd currentsong | grep "Title: " | sed -e 's/Title: //'`

if [ "$artist-$title" == "-" ] ; then
echo $filename
else
echo "$artist -- $title"
fi
}

function mpd_status () {
status=`send_command_to_mpd status`
play_or_pause=`echo $status | sed -e 's/.*state: //' -e 's/ song:.*//'`
case $play_or_pause in
play ) echo play ;;
pause ) echo pause ;;
stop ) echo stop ;;
* ) echo unknown ;;
esac
}

case "$1" in
play_pause )
case `mpd_status` in
play ) send_command_to_mpd pause && xecho "`get_current_song`" ;;
pause ) send_command_to_mpd play && xecho "`get_current_song`" ;;
stop ) send_command_to_mpd play && xecho "`get_current_song`" ;;
esac ;;
stop ) send_command_to_mpd stop && xecho "`get_current_song`" ;;
next ) send_command_to_mpd next && xecho "`get_current_song`" ;;
previous ) send_command_to_mpd previous && xecho "`get_current_song`" ;;
* ) exit 1;;
esac

exit 0

Friday, May 19, 2006

A comment on schedules...

A comment on schedules:
Ok, how long will it take?
For each manager involved in initial meetings add one month.
For each manager who says "data flow analysis" add another month.
For each unique end-user type add one month.
For each unknown software package to be employed add two months.
For each unknown hardware device add two months.
For each 100 miles between developer and installation add one month.
For each type of communication channel add one month.
If an IBM mainframe shop is involved and you are working on a non-IBM
system add 6 months.
If an IBM mainframe shop is involved and you are working on an IBM
system add 9 months.
Round up to the nearest half-year.
--Brad Sherman
By the way, ALL software projects are done by iterative prototyping.
Some companies call their prototypes "releases", that's all.

Friday, May 5, 2006

Tirando le somme ...

Tirando le somme di questa settimana posso dire che le cose non sono andate bene. La settimana in se è stata abbastanza tranquilla e ho conosciuto anche qualcuno abbastanza simpatico.