parent
0b4197ab63
commit
5ffd5328db
@ -0,0 +1,18 @@ |
|||||||
|
with import <nixpkgs> {}; |
||||||
|
|
||||||
|
stdenv.mkDerivation { |
||||||
|
name = "timelapse"; |
||||||
|
src = ./.; |
||||||
|
|
||||||
|
buildInputs = with pkgs; [ ruby gphoto2 ]; |
||||||
|
|
||||||
|
installPhase = '' |
||||||
|
mkdir -p $out/bin |
||||||
|
cp timelapse.rb $out/bin/timelapse |
||||||
|
''; |
||||||
|
|
||||||
|
meta = with lib; { |
||||||
|
description = "A small tool to capture timelapse series with gphoto"; |
||||||
|
}; |
||||||
|
} |
||||||
|
|
@ -0,0 +1,13 @@ |
|||||||
|
#!/usr/bin/env ruby |
||||||
|
|
||||||
|
# A function to capture a picture with gphoto2, retrying 3-times in |
||||||
|
# case of errors. |
||||||
|
def capture_picture |
||||||
|
3.times do |
||||||
|
break if `gphoto2 --capture-image` == 0 |
||||||
|
puts "Retrying gphoto2 capture..." |
||||||
|
end |
||||||
|
end |
||||||
|
|
||||||
|
|
||||||
|
capture_picture |
Loading…
Reference in new issue