diff --git a/homepage/zeldb.sh b/homepage/zeldb.sh index e1bc3c0..2433db6 100755 --- a/homepage/zeldb.sh +++ b/homepage/zeldb.sh @@ -3,16 +3,24 @@ set -e if ! command -v curl >/dev/null 2>&1; then printf "This script depends on curl.\n" - exit 1 + exit 64 # sysexits(3) EX_USAGE fi ZELDA="https://archive.org/download/cirno_actually_plays_zelda_in_terminal/zelda.wav" +CURL="curl -Ls" + +if command -v aplay >/dev/null 2>&1; # ALSA + then $CURL "$ZELDA" | aplay + +elif ls /dev/dsp >/dev/null 2>&1; # OSS + then curl -L "$ZELDA" >/dev/dsp + +elif command -v audioplay >/dev/null 2>&1; # NetBSD audio(4) + then $CURL "$ZELDA" | audioplay -f -e ulinear -P 16 -s 48000 -if which aplay >/dev/null 2>&1; then curl -L "$ZELDA" | aplay # ALSA -elif ls /dev/dsp >/dev/null 2>&1; then curl -L "$ZELDA" >/dev/dsp # OSS else printf "Unknown sound device. Sorry!\n" - exit 1 + exit 70 # sysexits(3) EX_SOFTWARE fi exit 0