We have surprisingly warm days here for late October and the #wakeboard cable park so close to my home is still open.
A while ago they added a webcam, and this morning I decided to write a short program to monitor the webcam from my home while I'm there. Unfortunately the webcam has low resolution and is updated somewhat irregularly every 10–60 seconds (strange). Still I found at least this (somewhat lame :) shot – blue helmet and dark blue shorts identify me, sort of.
Here's the simple ad-hoc #applescript to download images from that webcam. For such simple things I prefer AppleScript. The periodic idle handler times a unix shell call which uses curl. The longest bit of code is to name the file based on time, but I often use that code anyway.
--Retrieve pictures from a web cam every few seconds
--2012-10-21 Michael Bach, www.michaelbach.de
property periodInSeconds : 10
get1picture() -- this call helps to try it in the AppleScript editor, since the idle handler only works in stand-alone apps
on idle -- this is periodically called
on get1picture() -- retrieving the picture via "curl" and naming the picture based on time
set theDate to (the current date)
set dateString to ((year of theDate) as string) & "-" & twoDigits((month of theDate) as number) & "-" & twoDigits(day of theDate) & " " & twoDigits(hours of theDate) & "." & twoDigits((minutes of theDate) as number) & "." & twoDigits(seconds of theDate)
do shell script "curl 'http://www.wavecamp.eu/webcam/webcam.jpg' -o '" & "/Users/bach/Desktop/webCam/" & dateString & ".jpg'"
if i < 10 then return "0" & (i as string)
return (i as string)