Last active
April 2, 2016 19:12
-
-
Save dardo82/d0cbf6d7a9b26e6a79de to your computer and use it in GitHub Desktop.
Astro Animal Audio
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
#!/bin/zsh | |
events=(sunrise sunset moon_transit) | |
WA_URL="http://api.wolframalpha.com/v2/query?format=plaintext&appid=UYJL7G-54E6J64EK2&input=" | |
for event in $events; do | |
eval $event=$(curl -s "$WA_URL${event/_/+}" | gawk -v RS='</?plaintext>' 'NR==4 {print $1$2}') | |
eval echo play '"/Library/Application\ Support/Astro\ Animal\ Audio/"'$event.aiff \| at \$$event | |
done |
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
#!/bin/zsh | |
CAAP="/System/Library/LaunchDaemons/com.apple.atrun.plist" | |
AAAD="$HOME/Library/Application Support/Astro Animal Audio" | |
IDAP="$HOME/Library/LaunchAgents/it.dardo82.AstroAnimalAudio.plist" | |
cd ${0%/*}; chmod +x aaa.sh; mkdir $AAAD; cp aaa.sh $AAAD; cd $AAAD | |
youtube-dl https://goo.gl/yDSNzf | |
ls *.mp4 | xargs -I @ ffmpeg -i @ @.aiff; rm *.mp4 | |
a=(*.aiff); e=(sunrise sunset moon_transit) | |
for i in $(seq ${#e}); do mv ${a[$i]} ${e[$i]}.aiff; done | |
sed -E -i "" s%true%false%g $CAAP | |
sed -E s%30%86400%g $CAAP > $IDAP | |
sed -E -i "" s%/usr/libexec/atrun%$AAAD/aaa.sh%g $IDAP | |
launchctl load $CAAP; launchctl load $IDAP |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment