Last active
August 11, 2016 18:30
-
-
Save KevM/54e8e43bf1a89edd4d8ddb1a7db21d90 to your computer and use it in GitHub Desktop.
Bash script to monitor the Alamo Drafthouse calendar for changes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Usage: Run script with watch to repeat this check every N seconds `watch -n 20 ./mp.sh` | |
# On macos: `brew install jq watch` | |
# Example Used for Master Pancake CYOP tickets that often go on sale and then sell out quickly. | |
rm mp*.json | |
# Download the Alamo Drafthouse calendar for Austin | |
curl -s https://feeds.drafthouse.com/adcService/showtimes.svc/calendar/0002/ > mp.json | |
# Hacky jq query to pull out the Ritz location's events for the desired week/day combinations | |
cat mp.json | jq .Calendar.Cinemas[0].Months[0].Weeks[2].Days[4] >> mp-res.json | |
cat mp.json | jq .Calendar.Cinemas[0].Months[0].Weeks[2].Days[5] >> mp-res.json | |
# See if there is a difference between the current and previous results | |
DIFF=$(diff mp-res.json mp-res.old) | |
if [ "$DIFF" != "" ] | |
then | |
echo 'Something changed.' | |
osascript -e 'display notification "Alamo day check has a change." sound name "Frog" with title "Master Pancake"' | |
else | |
cp mp-res.json mp-res.old | |
fi | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You don't need to pipe
mp.json
intojq
, just use the command-line interface provided.Furthermore, if you overwrote instead of appended the output from the first command you could drop the
rm mp*.json
step.I'm not that familiar with scripting on OSX. Your use of
osascript
is cool! I didn't know how to do that.