X-Git-Url: http://git.grml.org/?a=blobdiff_plain;f=usr_bin%2Fsoundtest;fp=usr_bin%2Fsoundtest;h=73d87b85783b6b8e2c5fbc16647de27d82706257;hb=86460cc3653e55e63ee6ffb1cdf9800c74e22b7a;hp=b3b3395de38e178e402181465d1ff05baabd7224;hpb=07f890215d35a8b3a184df14c47617a4e8a00d5d;p=grml-scripts.git diff --git a/usr_bin/soundtest b/usr_bin/soundtest index b3b3395..73d87b8 100755 --- a/usr_bin/soundtest +++ b/usr_bin/soundtest @@ -4,15 +4,30 @@ # Authors: grml-team (grml.org), (c) Michael Prokop # Bug-Reports: see http://grml.org/bugs/ # License: This file is licensed under the GPL v2. -# Latest change: Sun Jan 15 22:46:13 CET 2006 [mika] +# Latest change: Sam Jän 19 17:08:34 CET 2008 [mika] ################################################################################ PN=`basename "$0"` -[ -z "$PLAYER" ] && PLAYER="ogg123" + +if [ -z "$PLAYER" ] ; then + [ -x /usr/bin/mplayer ] && PLAYER="mplayer" + [ -x /usr/bin/ogg123 ] && PLAYER="ogg123" +fi + +if ! [ $(which $PLAYER) ] ; then + echo "Sorry, neither mplayer nor ogg123 available and \$PLAYER is not set.">&2 + exit 1 +fi + if [ -z "$1" ] ; then - FILE="/usr/share/grml/effect.ogg" + FILE="/usr/share/grml/effect.ogg" else - FILE="$*" + FILE="$*" +fi + +if ! [ -r "$FILE" ] ; then + echo "Sorry, /usr/share/grml/effect.ogg of package grml-files not available.">&2 + exit 1 fi echo "$PN - trying to play $FILE with $PLAYER @@ -21,11 +36,11 @@ You do not hear anything? Make sure volume is not turned off. Adjust mixer settings via aumix or alsamixer. Tip: $PN supports some options. -Just provide the files you want to play as arguments, +Just provide the file(s) you want to play as argument(s), adjust player which should be used for playing the files via environment variable PLAYER. Usage example: - PLAYER=mp3blaster $PN /usr/share/grml/effect.ogg /another/file/to/play.mp3 + PLAYER=mplayer $PN /usr/share/grml/effect.ogg /another/file/to/play.mp3 " $PLAYER $FILE && echo "It looks like sound works for you. :-)" || echo "problems with sound? :-("