Skip to content

Instantly share code, notes, and snippets.

@simen
Last active December 17, 2015 19:19
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save simen/5659395 to your computer and use it in GitHub Desktop.
dropbox = require 'dropbox-node'
strftime = require 'strftime'
child_process = require 'child_process'
client = new dropbox.DropboxClient("<api key>", "<api secret>",
'<user token>', '<user secret>')
command = "fswebcam"
options = ['--no-banner', '--resolution', '800x600', '--skip', '10', '--frames', '50', '--no-timestamp', '--save', 'snapshot.jpg']
snapShot = ->
child = child_process.spawn(command, options, {stdio: 'inherit'});
child.on 'exit', ->
client.putFile './snapshot.jpg', "/timelapse/#{strftime('%Y-%m-%d_%H-%M-%S')}.jpg", (err, data) ->
console.log err, data
minutes = 0.5
console.log "Snapping a shot every #{minutes} minute"
snapShot()
setInterval(snapShot, minutes*60*1000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment