diff --git a/README.md b/README.md index 17918b5..f09a4fe 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,27 @@ Makefile-based static site generator for sharing photos. +## Building a Page + +`nix develop` drops you into a shell with all prerequisites. +Running + +```bash +IMAGE_DIR=path/to/image_dir make +``` + +builds a self-contained static page and stores it in `./dist` (or `DIST_DIR` if set). +You can use all the usual `make` goodies such as `-j` to enable parallel builds. + +## Data Model + +The data model is simply the list of all `.jpg` files in `IMAGE_DIR` and its subdirectories, enriched with EXIF metadata. + ## TODO - [x] Generate .zip archive of all photos and offer it for download -- [ ] Make `make clean-dist` remove only unused photos (i.e. all photos in dist setminus photos that are supposed to be in dist) -- [ ] Make a pretty index page +- [x] Write a faster `./extract-metadata.py` alternative +- [x] Make a pretty index page - [x] Generate .webp thumbnails for index page +- [ ] Make `make clean-dist` remove only unused photos (i.e. all photos in dist setminus photos that are supposed to be in dist) +- [ ] Make a mobile page diff --git a/extra/fonts/source-sans-pro-regular.woff2 b/extra/fonts/source-sans-pro-regular.woff2 new file mode 100644 index 0000000..efa300c Binary files /dev/null and b/extra/fonts/source-sans-pro-regular.woff2 differ diff --git a/extra/fonts/source-sans-pro.css b/extra/fonts/source-sans-pro.css new file mode 100644 index 0000000..b34874a --- /dev/null +++ b/extra/fonts/source-sans-pro.css @@ -0,0 +1,9 @@ +/* Taken from fonts.googleapis.com/css?family=Source+Sans+Pro:400 */ + +@font-face { + font-family: 'Source Sans Pro'; + font-style: normal; + font-weight: 400; + src: local('Source Sans Pro Regular'), local('SourceSansPro-Regular'), url(./source-sans-pro-regular.woff2) format('woff2'); + unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215; +} diff --git a/flake.lock b/flake.lock index ba7279e..2215c74 100644 --- a/flake.lock +++ b/flake.lock @@ -22,11 +22,11 @@ "nixpkgs": "nixpkgs" }, "locked": { - "lastModified": 1736429655, - "narHash": "sha256-BwMekRuVlSB9C0QgwKMICiJ5EVbLGjfe4qyueyNQyGI=", + "lastModified": 1739824009, + "narHash": "sha256-fcNrCMUWVLMG3gKC5M9CBqVOAnJtyRvGPxptQFl5mVg=", "owner": "nix-community", "repo": "naersk", - "rev": "0621e47bd95542b8e1ce2ee2d65d6a1f887a13ce", + "rev": "e5130d37369bfa600144c2424270c96f0ef0e11d", "type": "github" }, "original": { @@ -38,11 +38,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1739138025, - "narHash": "sha256-M4ilIfGxzbBZuURokv24aqJTbdjPA9K+DtKUzrJaES4=", + "lastModified": 1739863612, + "narHash": "sha256-UbtgxplOhFcyjBcNbTVO8+HUHAl/WXFDOb6LvqShiZo=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "b2243f41e860ac85c0b446eadc6930359b294e79", + "rev": "632f04521e847173c54fa72973ec6c39a371211c", "type": "github" }, "original": { @@ -52,11 +52,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1739138025, - "narHash": "sha256-M4ilIfGxzbBZuURokv24aqJTbdjPA9K+DtKUzrJaES4=", + "lastModified": 1739863612, + "narHash": "sha256-UbtgxplOhFcyjBcNbTVO8+HUHAl/WXFDOb6LvqShiZo=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "b2243f41e860ac85c0b446eadc6930359b294e79", + "rev": "632f04521e847173c54fa72973ec6c39a371211c", "type": "github" }, "original": { diff --git a/index.hbs b/index.hbs index 79d3fba..570277d 100644 --- a/index.hbs +++ b/index.hbs @@ -1,9 +1,10 @@ - -photos - + + photo gallery + +
diff --git a/photo.hbs b/photo.hbs index 827e47f..ba2c1aa 100644 --- a/photo.hbs +++ b/photo.hbs @@ -1,9 +1,10 @@ - -{{ path.name }} - + + {{ path.name }} + +
@@ -15,9 +16,9 @@

prev · next · up

{{ exif.datetime }}

- exposure time ???
- aperture ???
- iso ???
+ exposure time {{ exif.ExposureTime.num }}⁄{{ exif.ExposureTime.denom }} s
+ aperture f{{ exif.FNumber.f64 }}
+ iso {{ exif.PhotographicSensitivity }}
resolution {{ exif.PixelXDimension }}x{{ exif.PixelYDimension }}

diff --git a/squeezer/src/main.rs b/squeezer/src/main.rs index 92ae063..db2d126 100644 --- a/squeezer/src/main.rs +++ b/squeezer/src/main.rs @@ -8,8 +8,9 @@ fn map_to_value(tag: exif::Tag, value: exif::Value) -> Value { } if let exif::Value::Rational(rs) = value { return serde_json::json!({ - "num": Value::Number(rs[0].num.into()), - "denom": Value::Number(rs[0].denom.into()), + "num": rs[0].num, + "denom": rs[0].denom, + "f64": rs[0].to_f64(), }); } Value::String(value.display_as(tag).to_string())