Skip to content

Instantly share code, notes, and snippets.

@dardo82
Last active April 2, 2016 19:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dardo82/d0cbf6d7a9b26e6a79de to your computer and use it in GitHub Desktop.
Save dardo82/d0cbf6d7a9b26e6a79de to your computer and use it in GitHub Desktop.
Astro Animal Audio
#!/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
#!/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