commit 74c1f7734935b4cc276d635fce89a980ef355c83 Author: Dejvino Date: Sun Dec 13 23:15:26 2020 +0100 Add emergency test, announce time and weather diff --git a/bin/announce-time b/bin/announce-time new file mode 100755 index 0000000..7f96c34 --- /dev/null +++ b/bin/announce-time @@ -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 + diff --git a/bin/announce-weather b/bin/announce-weather new file mode 100755 index 0000000..dcf2975 --- /dev/null +++ b/bin/announce-weather @@ -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 + diff --git a/bin/emergency-test b/bin/emergency-test new file mode 100755 index 0000000..55c8835 --- /dev/null +++ b/bin/emergency-test @@ -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 + diff --git a/bin/pa-lib b/bin/pa-lib new file mode 100644 index 0000000..5844f60 --- /dev/null +++ b/bin/pa-lib @@ -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 "$@" +} + + diff --git a/sounds/announcement_4-tone_up.ogg b/sounds/announcement_4-tone_up.ogg new file mode 100755 index 0000000..071b8d4 Binary files /dev/null and b/sounds/announcement_4-tone_up.ogg differ diff --git a/sounds/announcement_4-tone_up_quickest.ogg b/sounds/announcement_4-tone_up_quickest.ogg new file mode 100755 index 0000000..e968ab8 Binary files /dev/null and b/sounds/announcement_4-tone_up_quickest.ogg differ diff --git a/sounds/announcement_4-tone_up_smooth.ogg b/sounds/announcement_4-tone_up_smooth.ogg new file mode 100755 index 0000000..ad1b36f Binary files /dev/null and b/sounds/announcement_4-tone_up_smooth.ogg differ diff --git a/sounds/announcement_4-tone_up_smooth_quick.ogg b/sounds/announcement_4-tone_up_smooth_quick.ogg new file mode 100755 index 0000000..f94df46 Binary files /dev/null and b/sounds/announcement_4-tone_up_smooth_quick.ogg differ