Add emergency test, announce time and weather

This commit is contained in:
Dejvino 2020-12-13 23:15:26 +01:00
commit 74c1f77349
8 changed files with 121 additions and 0 deletions

20
bin/announce-time Executable file
View File

@ -0,0 +1,20 @@
#!/bin/bash
source pa-lib
pa-preheat
pa-announcement
DATE=`date +"%B %d, %Y"`
pa-say "The date is $DATE."
sleep "0.5"
TIME=`date +"%l %p and %M minutes"`
pa-say "It is $TIME."
pa-announcement-quick
pa-shutdown

24
bin/announce-weather Executable file
View File

@ -0,0 +1,24 @@
#!/bin/bash
source pa-lib
WFILE=/tmp/weather
LOCATION="BRQ"
info "Fetching weather report for $LOCATION."
weather -q -m $LOCATION > $WFILE
pa-preheat
pa-announcement
pa-say "Here is the latest weather report:"
cat $WFILE
pa-say -f "$WFILE" -l 80
pa-say "Have a great day!"
pa-announcement-quick
pa-shutdown

26
bin/emergency-test Executable file
View File

@ -0,0 +1,26 @@
#!/bin/bash
source pa-lib
pa-preheat
pa-announcement-quickest
pa-say "Test of emergency warning system will begin."
sleep 1
emergency-light on
pa-say "This is only a test. In the event of an emergency, this emergency warning light would be used to declare an emergency."
pa-say "This is only a test."
sleep 1
emergency-light off
pa-say "This was a test of the emergency warning light system. Thank you for your cooperation."
pa-announcement-quick
pa-shutdown

51
bin/pa-lib Normal file
View File

@ -0,0 +1,51 @@
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
export ROOT=`dirname "$DIR"`
export SOUNDS=$ROOT/sounds
export PLAYER=mplayer
export SPEAK=espeak-ng
function info() {
echo "[INFO]" $@
}
function play() {
$PLAYER $@ > /dev/null 2>&1
}
function pa-preheat() {
info "PA Preheating"
pa-power off
play $SOUNDS/announcement_4-tone_up_quickest.ogg
pa-power on
info "PA Ready"
}
function pa-shutdown() {
info "PA Shutdown"
pa-power off
}
function pa-announcement() {
info " DING DONG "
play $SOUNDS/announcement_4-tone_up_smooth.ogg
}
function pa-announcement-quick() {
info " Ding Dong "
play $SOUNDS/announcement_4-tone_up_smooth_quick.ogg
}
function pa-announcement-quickest() {
info " ding-dong "
play $SOUNDS/announcement_4-tone_up_quickest.ogg
}
function pa-say() {
info "Say: $@"
$SPEAK "$@"
}

BIN
sounds/announcement_4-tone_up.ogg Executable file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.