diff options
author | Katharina Fey <kookie@spacekookie.de> | 2021-03-09 21:18:38 +0100 |
---|---|---|
committer | Katharina Fey <kookie@spacekookie.de> | 2021-03-09 21:18:38 +0100 |
commit | 5ffd5328dbe8e00718ca229b8a113fd617c5dfd1 (patch) | |
tree | e5cbc52ea8959d792189037b45607928fb4dd498 | |
parent | 0b4197ab6312471c9dd0feeb932a6973dcf10630 (diff) |
timelapse: initial code dump
-rw-r--r-- | apps/timelapse/.projectile | 0 | ||||
-rw-r--r-- | apps/timelapse/default.nix | 18 | ||||
-rwxr-xr-x | apps/timelapse/timelapse.rb | 13 |
3 files changed, 31 insertions, 0 deletions
diff --git a/apps/timelapse/.projectile b/apps/timelapse/.projectile new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/apps/timelapse/.projectile diff --git a/apps/timelapse/default.nix b/apps/timelapse/default.nix new file mode 100644 index 000000000000..8adc4ef06209 --- /dev/null +++ b/apps/timelapse/default.nix @@ -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"; + }; +} + diff --git a/apps/timelapse/timelapse.rb b/apps/timelapse/timelapse.rb new file mode 100755 index 000000000000..aa6b6b3106ae --- /dev/null +++ b/apps/timelapse/timelapse.rb @@ -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 |