tadd variable to easy enable/disable speech synth - exercise_time - announce workout exercises with notifications and speech synth (HTM) git clone git://src.adamsgaard.dk/exercise_time (DIR) Log (DIR) Files (DIR) Refs (DIR) LICENSE --- (DIR) commit 8c7abf57713fe7a4c9cf5234451633f7082d4248 (DIR) parent 20d01b91fcdc8cf54a18f17cedac8675a3f3760c (HTM) Author: Anders Damsgaard <anders.damsgaard@geo.au.dk> Date: Mon, 2 Feb 2015 15:20:31 +0100 add variable to easy enable/disable speech synth Diffstat: M exercise_time.sh | 45 +++++++++++++++++-------------- 1 file changed, 25 insertions(+), 20 deletions(-) --- (DIR) diff --git a/exercise_time.sh b/exercise_time.sh t@@ -18,6 +18,9 @@ # Wait time in seconds between sets WAITSECS=120 +# Announce via speech synth (0: No, 1: Yes) +SPEECHSYNTH=1 + function usage { echo "Usage: $1 <SETS> <EXERCISE>" echo "Example: For three sets of ten pushups, use:" t@@ -45,30 +48,32 @@ for ((i=0; i<$1; i++)); do # Use speech synthesis if the computer is plugged in at my office desk - # OS X - if [[ "$UNAMESTR" == 'Darwin' ]]; then - if [[ "$(ifconfig | grep 10.17.8)" ]]; then - say "$announcement" - fi + if [ $SPEECHSYNTH -eq 1 ]; then + # OS X + if [[ "$UNAMESTR" == 'Darwin' ]]; then + if [[ "$(ifconfig | grep 10.17.8)" ]]; then + say "$announcement" + fi - # Linux - elif [[ "$UNAMESTR" == 'Linux' ]]; then + # Linux + elif [[ "$UNAMESTR" == 'Linux' ]]; then - playingmusic=0 + playingmusic=0 - if [[ "$(ip addr | grep 10.17.8)" ]]; then - if command -v mpc &>/dev/null; then - if [[ "$(mpc | grep playing)" ]]; then - mpc pause &> /dev/null - playingmusic=1 + if [[ "$(ip addr | grep 10.17.8)" ]]; then + if command -v mpc &>/dev/null; then + if [[ "$(mpc | grep playing)" ]]; then + mpc pause &> /dev/null + playingmusic=1 + fi fi - fi - if command -v festival &>/dev/null; then - echo "$announcement" | festival --tts - fi - if command -v mpc &>/dev/null; then - if [[ $playingmusic -eq 1 ]]; then - mpc play &> /dev/null + if command -v festival &>/dev/null; then + echo "$announcement" | festival --tts + fi + if command -v mpc &>/dev/null; then + if [[ $playingmusic -eq 1 ]]; then + mpc play &> /dev/null + fi fi fi fi