-
Notifications
You must be signed in to change notification settings - Fork 0
/
kidsToSchool.sh
executable file
·39 lines (27 loc) · 1.22 KB
/
kidsToSchool.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
#!/bin/bash
export PATH="$PATH:/usr/local/bin"
cd $(dirname $0)
# need this calendar: http://schools.nyc.gov/Calendar/default.htm#phone
# https://calendar.google.com/calendar/ical/doecalendars%40gmail.com/public/basic.ics
# https://www.schools.nyc.gov/CustomApi/CalendarActions/DownloadCalendar
# https://www.schools.nyc.gov/docs/default-source/default-document-library/school-calendar-2019-2020
if [ ! -x icalBuddy ]; then
echo "This app relies on icalBuddy for school closure dates. icalBuddy is missing."
exit
fi
# check if school is closed, and exit if it is
./icalBuddy -nc -ic "NYC Public School Calendar" eventsFrom:"$(date +'%b %d, %Y')" to:"$(date +'%b %d, %Y')" | /usr/bin/paste -s -d " " - | /usr/bin/egrep -i '(do not attend|school.*closed)' >/dev/null && exit 1
RECEIVER_STATE=$(./receiverState.sh)
./receiverState.sh on HDMI1 0.75 2>/dev/null
# Give receiver time to boot up
[[ "$RECEIVER_STATE" =~ ^on\ HDMI1 ]] || sleep 15
prefixes=("Дети" "Повторяю")
for (( i=0; i<2; i++ )); do
if [ -n "${prefixes[$i]}" ]; then
prefix="${prefixes[$i]}"
fi
say -v Milena "$prefix, время одеваться и готовиться к выходу."
sleep 2
done
./receiverState.sh $RECEIVER_STATE 2>/dev/null
exit 1