diff options
author | tv <tv@xso> | 2011-09-10 03:53:09 +0200 |
---|---|---|
committer | tv <tv@xso> | 2011-09-10 03:53:09 +0200 |
commit | 0c72cef00ad7c1cb0cb672e03325f8b7b763e3c2 (patch) | |
tree | 3f2e102a99c9d8cb89f366150f6528f65b2b453b /noise/modules | |
parent | 3aaf385f29b0f9c8bc815347f92890b2542cf1e1 (diff) | |
parent | 9c9e9809e61e5e6a45c5f5babd0fef17cdc1d33d (diff) |
Merge branch 'master' of github.com:krebscode/painload
Diffstat (limited to 'noise/modules')
-rwxr-xr-x | noise/modules/overlord | 30 | ||||
-rwxr-xr-x | noise/modules/temp | 42 |
2 files changed, 27 insertions, 45 deletions
diff --git a/noise/modules/overlord b/noise/modules/overlord index 6df2451d..ded8627a 100755 --- a/noise/modules/overlord +++ b/noise/modules/overlord @@ -1,26 +1,14 @@ #! /bin/sh set -euf -announce() { -sleep 0.4; amixer -q -c 0 -D hw:0 sset Front 90% -sleep 0.4; amixer -q -c 0 -D hw:0 sset Front 80% -sleep 0.4; amixer -q -c 0 -D hw:0 sset Front 70% -sleep 0.4; amixer -q -c 0 -D hw:0 sset Front 60% -sleep 0.4; amixer -q -c 0 -D hw:0 sset Front 50% -/krebs/streams/streams stop -amixer -q -c 0 -D hw:0 sset Front 100% -mplayer /krebs/god/overlord/announce.mp3 -/krebs/streams/streams start & -espeak -v de -s 120 -a 900 "$*" -amixer -q -c 0 -D hw:0 sset Front 40% -sleep 0.4; amixer -q -c 0 -D hw:0 sset Front 50% -sleep 0.4; amixer -q -c 0 -D hw:0 sset Front 60% -sleep 0.4; amixer -q -c 0 -D hw:0 sset Front 70% -sleep 0.4; amixer -q -c 0 -D hw:0 sset Front 80% -sleep 0.4; amixer -q -c 0 -D hw:0 sset Front 90% -} +# cd // +cd $(dirname $(readlink -f $0))/../.. -case "$1" in - --help) echo "Make an announcement! Usage: /overlord <text>";; - *) announce "$@";; +case "${1---help}" in + --help) + echo "Make an announcement! Usage: /overlord <text>" + ;; + *) + exec god/overlord/index "$@" + ;; esac diff --git a/noise/modules/temp b/noise/modules/temp index 2f1dfcef..a11c3720 100755 --- a/noise/modules/temp +++ b/noise/modules/temp @@ -1,33 +1,32 @@ #! /bin/bash +temper=/krebs/temper/temper + main() { - case "$1" in + case "${1--K}" in (--help) echo "report temperature in K, °C, °R, or °F." + exit ;; - (-C|--celsius) - espeak_inside `inside_temp 'x - 273.15'` Grad Zelsius - espeak_outside `outside_temp 'x - 273.15'` Grad Zelsius - ;; - (-F|--fahrenheit) - espeak_inside `inside_temp 'x * 9/5 - 459.67'` Grad Fahrenheit - espeak_outside `outside_temp 'x * 9/5 - 459.67'` Grad Fahrenheit - ;; - (-R|--rankine) - espeak_inside `inside_temp 'x * 9/5'` Grad Renkin - espeak_outside `outside_temp 'x * 9/5'` Grad Renkin - ;; - (-K|--kelvin|*) - espeak_inside `inside_temp` Kelvin - espeak_outside `outside_temp` Kelvin + (-C|--celsius) unit='Grad Zelsius' ; formula='x - 273.15' ;; + (-F|--fahrenheit) unit='Grad Fahrenheit'; formula='x * 9/5 - 459.67' ;; + (-R|--rankine) unit='Grad Renkin' ; formula='x * 9/5' ;; + (-K|--kelvin) unit='Kelvin' ; formula='x' ;; + (*) + echo 'Error 1: you are made of stupid!' + exit 23 ;; esac + if test -f $temper -a -x $temper; then + espeak_inside `inside_temp "$formula"` $unit + fi + espeak_outside `outside_temp "$formula"` $unit } ## temp [<formula with temperature as x>] ## Echo temperature in K. If formula is given then return that result instead. inside_temp() { - echo "scale=2; x=`/krebs/temper/temper` + 273.15; ${1-x}" | bc + echo "scale=2; x=`$temper` + 273.15; ${1-x}" | bc } outside_temp() { @@ -36,13 +35,8 @@ outside_temp() { ` + 273.15; ${1-x}" | bc } -espeak_inside() { - echo Die Krebs-tempera-tur beträgt $@ | to_espeak -} - -espeak_outside() { - echo Die Außen-tempera-tur beträgt $@ | to_espeak -} +espeak_inside() { echo Die Krebs-tempera-tur beträgt $@ | to_espeak; } +espeak_outside() { echo Die Außen-tempera-tur beträgt $@ | to_espeak; } to_espeak() { sed ' |