-
Notifications
You must be signed in to change notification settings - Fork 6
/
CheckIfPlaying.sh
executable file
·47 lines (39 loc) · 1.36 KB
/
CheckIfPlaying.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/sh
###########################################################
# CheckIfPlaying.sh - Run scripts based on whether or not #
# FPP is currently playing a sequence of some sort. #
###########################################################
# Edit this line to hold the script name to run if nothing is currently being played
SCRIPT_IF_NOT_PLAYING="PUT YOUR SCRIPT NAME HERE (NOT PlAYING)"
# Edit this line to hold the script name to run if something is currently playing
SCRIPT_IF_PLAYING="PUT YOUR SCRIPT NAME HERE (PLAYING)"
###########################################################
# Guts of the script. You probably don't need to edit #
# anything below this block #
###########################################################
# Get our current status
STATUS=$(fpp -s | cut -d',' -f2)
# Check that we got something meaningful
if [ -z "${STATUS}" ]; then
echo "Error with status value" >&2
exit 1
fi
# Act on the current status
case ${STATUS} in
# IDLE
0)
if [ -e "${MEDIADIR}/scripts/${SCRIPT_IF_NOT_PLAYING}" ]; then
eventScript "${MEDIADIR}/scripts/${SCRIPT_IF_NOT_PLAYING}"
fi
;;
# PLAYING
1)
if [ -e "${MEDIADIR}/scripts/${SCRIPT_IF_PLAYING}" ]; then
eventScript "${MEDIADIR}/scripts/${SCRIPT_IF_PLAYING}"
fi
;;
# STOPPING GRACEFULLY
2|*)
# Do nothing for stopping gracefully for now, or unknown
;;
esac