timelapse: initial code dump

wip/yesman
Katharina Fey 3 years ago
parent 0b4197ab63
commit 5ffd5328db
Signed by: kookie
GPG Key ID: 90734A9E619C8A6C
  1. 0
      apps/timelapse/.projectile
  2. 18
      apps/timelapse/default.nix
  3. 13
      apps/timelapse/timelapse.rb

@ -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…
Cancel
Save