| tonly stop and start music if it is playing - exercise_time - announce workout … | |
| git clone git://src.adamsgaard.dk/exercise_time | |
| Log | |
| Files | |
| Refs | |
| LICENSE | |
| --- | |
| commit 2505b02d2811b533e7de9c29620a7f30fcc72c8c | |
| parent ca126c4f9a6d9441cec601bb781b3352d47d0d0d | |
| Author: Anders Damsgaard <[email protected]> | |
| Date: Fri, 30 Jan 2015 14:13:26 +0100 | |
| only stop and start music if it is playing | |
| Diffstat: | |
| M exercise_time.sh | 11 +++++++++-- | |
| 1 file changed, 9 insertions(+), 2 deletions(-) | |
| --- | |
| diff --git a/exercise_time.sh b/exercise_time.sh | |
| t@@ -55,15 +55,22 @@ for ((i=0; i<$1; i++)); do | |
| # Linux | |
| elif [[ "$UNAMESTR" == 'Linux' ]]; then | |
| + playingmusic=0 | |
| + | |
| if [[ "$(ip addr | grep 10.17.8)" ]]; then | |
| if command -v mpc &>/dev/null; then | |
| - mpc pause &> /dev/null | |
| + if [[ "$(mpc | grep playing)" ]]; then | |
| + mpc pause &> /dev/null | |
| + playingmusic=1 | |
| + fi | |
| fi | |
| if command -v festival &>/dev/null; then | |
| echo "$announcement" | festival --tts | |
| fi | |
| if command -v mpc &>/dev/null; then | |
| - mpc play &> /dev/null | |
| + if [[ $playingmusic -eq 1 ]]; then | |
| + mpc play &> /dev/null | |
| + fi | |
| fi | |
| fi | |
| fi |