Last active
January 2, 2016 01:59
-
-
Save trodemaster/8234205 to your computer and use it in GitHub Desktop.
Stevens Pass - download webcam images and set as both desktops
This file contains 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/bash | |
# Download webcam image and archive | |
# | |
jpg_name_base=base`date "+%y%m%d-%H%M"`.jpg | |
jpg_name_sky=sky`date "+%y%m%d-%H%M"`.jpg | |
jpg_dirBase=/Volumes/Zen/images/StevensBase13-14/ | |
jpg_dirSky=/Volumes/Zen/images/StevensSky13-14/ | |
dtpat1=$jpg_dirBase$jpg_name_base | |
dtpat2=$jpg_dirSky$jpg_name_sky | |
jpg_url1=http://stevenspass.com/cams/base/ | |
jpg_url2=http://stevenspass.com/cams/mountain/ | |
log_file=/Users/blake/Library/Logs/stevensdt.log | |
echo updating webcam image $jpg_name_base $jpg_name_sky >> $log_file | |
dl_verify_jpeg () { | |
curl -s $1 -o $2 | |
#echo $2 | |
until [[ `/opt/local/bin/convert $2 -format "%[pixel: u.p{699,465}]" info:` != fractal ]] | |
do | |
echo bad jpeg found $2 attempting redownload | |
rm $2 | |
sleep 20 | |
curl -s $1 -o $2 | |
done | |
} | |
dl_verify_jpeg $jpg_url1 $dtpat1 | |
dl_verify_jpeg $jpg_url2 $dtpat2 | |
/usr/bin/automator -D dtpat1=$dtpat1 -D dtpat2=$dtpat2 /Library/Scripts/setdtpat.workflow | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment