Created
June 14, 2012 22:04
-
-
Save knoopx/2933250 to your computer and use it in GitHub Desktop.
Gitshots Post-Commit Hook
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
#!/usr/bin/env ruby | |
# Requires imagesnap from https://github.com/alexwilliamsca/imagesnap (brew install imagesnap) | |
# To assemble the video use http://www.dayofthenewdan.com/projects/tlassemble | |
file="~/.gitshots/#{Time.now.to_i}.jpg" | |
puts "Taking capture into #{file}!" | |
system "imagesnap -q -w 3 #{file}" | |
exit 0 |
Or you could simplify it like this ;)
#!/bin/sh
imagesnap -q $HOME/.gitshots/$(date "+%s").jpg &
Because on my system date -j -f "%a %b %d %T %Z %Y" "
date" "+%s"
fails to convert date
For Linux/Ubuntu you can use streamer
..
file="~/.gitshots/#{Time.now.to_i}.jpg"
puts "Taking capture into #{file}!"
system "streamer -f jpeg #{file}"
exit 0
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Fore a pure shell implementation:
This has the advantage of being run in the background, so you don't have to wait for the camera to finish after each commit.