Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Quartz's Fiscal Cliff Webcam bash script
#!/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
You can’t perform that action at this time.