Created
December 18, 2012 00:51
-
-
Save yanofsky/4323918 to your computer and use it in GitHub Desktop.
Quartz's Fiscal Cliff Webcam bash script
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 | |
# | |
#````````````````````````````````````````````````````````````````````````````````````````````````````````````````````` | |
#```````````***`````````````***```````***```````````***````````````******```````````************``````************```` | |
#```````***********`````````***```````***``````````*****```````````**********```````************``````************```` | |
#`````***`````````***```````***```````***`````````***`***``````````***`````***``````````***```````````````````***````` | |
#````***```````````***``````***```````***````````***```***`````````***``````***`````````***`````````````````***``````` | |
#````***```````````***``````***```````***```````***`````***````````***********``````````***```````````````***````````` | |
#````***``````***`***```````***```````***``````*************```````*********````````````***``````````````***`````````` | |
#`````***```````****`````````***`````***``````***************``````***````***```````````***````````````***```````````` | |
#```````*************`````````*********``````***```````````***`````***`````***``````````***```````````************```` | |
#```````````***`````**```````````***````````***`````````````***````***``````***`````````***```````````************```` | |
#````````````````````````````````````````````````````````````````````````````````````````````````````````````````````` | |
# | |
FTP_UN = " " | |
FTP_URL = " " | |
REM_DIR = "hastheusgoneoffthefiscalcliff.com/" | |
#kill any running camera processes (because macs will steal control of the camera sometimes) | |
killall -SIGINT PTPCamera | |
#take a new picture | |
gphoto2 --capture-image-and-download --filename imagecapture.jpg | |
#resize image | |
convert -resize 1000 -compress JPEG -quality 80 imagecapture.jpg imagecapture_1000.jpg | |
#resize image for social | |
convert -resize 550 -compress JPEG -quality 80 imagecapture.jpg imagecapture_550.jpg | |
#upload the photo to the remote server (we set up an authorized key on the remote so the script doesn't need a password) | |
scp imagecapture_1000.jpg $FTP_UN@$FTP_URL:$REM_DIR | |
#upload the sized-for-social social photo to the remote server | |
scp imagecapture_550.jpg $FTP_UN@$FTP_URL:$REM_DIR | |
#move file to local archive | |
mv imagecapture.jpg archive/archive-$(date +%F-%H%M%S).jpg |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment